How to load image form NSMutableArray

Posted by pbcoder on Stack Overflow See other posts from Stack Overflow or by pbcoder
Published on 2010-03-28T11:18:51Z Indexed on 2010/03/28 11:23 UTC
Read the original article Hit count: 212

Filed under:

I want to load the image URL from my NSMutableArray. Here is my Code:

id path = (NSString *)[[stories objectAtIndex: storyIndex] objectForKey: @"icon"];
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data cache:NO];

If I use: id path = @"http://www.xzy.de/icon.png"; it´s all right, but not if I want to extract the imageURL from my Array

Anyone who can help me? Thanks!

© Stack Overflow or respective owner

Related posts about objective-c