Using an NSString and UIImageView to load image from URL, failing on some URLs
I've got some code to load an image from a URL, it seems to work ok. Unless the URL contains curly brackets. This seems like it is a string formatting problem? I can't figure it out.
ex @"http://site/image.png //works
@"http://site/{image}.png //doesn't work
NSString* mapURL = @"http://site.com/directory/{map}.png";
NSLog(mapURL);
NSData* imageDa开发者_StackOverflowta = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:mapURL]];
UIImage* image = [[UIImage alloc] initWithData:imageData];
[imageView setImage:image];
[imageData release];
[image release];
thanks
i found this helpful
http://simonwoodside.com/weblog/2009/4/22/how_to_really_url_encode/
精彩评论