Show image from url in uiimageview

Posted by skiria on Stack Overflow See other posts from Stack Overflow or by skiria
Published on 2010-05-11T22:35:29Z Indexed on 2010/05/11 23:54 UTC
Read the original article Hit count: 203

I try to show a image in my iphone app but it doesn't show. I connect in IB and I check to show a local image, it workd good. I also check the url from image and it is ok. I use the next code:

NSURL *imageURL = [NSURL URLWithString: aVideo.urlThumbnail];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [UIImage imageWithData:imageData]; 
imageView.image = image;

and

//Video.h
NSString *urlThumbnail;

and this is my code on the view.

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [tableView reloadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];


    NSURL *imageURL = [NSURL URLWithString: aVideo.urlThumbnail];
    NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
    UIImage *image = [UIImage imageWithData:imageData]; 
    imageView.image = image;
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch