Despite all the answers saying that you do this in one line of code, this, unfortunately, has nothing to do with the speed of the URL connection or the decoding of data / images. If you need a faster way to type the code, then that’s fine, but I would use the category added to UIImageView ....
@interface UIImageView (URL)
- (void)loadFromUrl:(NSString *)aUrl;
@end
@implementation UIImageView (URL)
- (void)loadFromUrl:(NSString *)aUrl {
NSURL *url = [NSURL urlWithString:aUrl];
NSData *data = [NSData dataWithContentsOfURL:url]
UIImage *image = [UIImage imageWithData:data];
if(image != nil) {
[self setImage:image];
}
}
@end
...
[myImageView loadFromUrl:@"http://myurl.com/image.jpg"];
( !) . , !:)