Reputation: 508
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http://www.scri8e.com/effects/FL0WERZ/PNG/ir09.png"];
data = [[NSData alloc]initWithContentsOfURL:url ];
UIImage *img = [[UIImage alloc]initWithData:data ];
imageview.image=img;
}
above is my code but it does not load the image in image view
Upvotes: 2
Views: 9028
Reputation: 304
Try this library it will help you download images and display in the imageview.
Upvotes: 3
Reputation: 1287
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *url_Img1 = @"http://www.scri8e.com/effects/FL0WERZ/PNG";
NSString *url_Img2 = @"ir09.png";
NSString *url_Img_FULL = [url_Img1 stringByAppendingPathComponent:url_Img2];
NSLog(@"Show url_Img_FULL: %@",url_Img_FULL);
_view_Image.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url_Img_FULL]]];
}
Upvotes: 0
Reputation: 701
NSString *mainimg=[NSString stringWithFormat:@"%@",[[xmlDataDictionary valueForKeyPath:@"eg.main.img1"]objectAtIndex:indexPath.row]];
NSURL *url = [NSURL URLWithString:mainimg];
NSData *image = [[NSData alloc] initWithContentsOfURL:url];
cell.img.image=[UIImage imageWithData:image];
Try this for parsed url..
So simple..
Upvotes: 0
Reputation: 1082
If you are taken imageview directly in xib, than just check connection in connection inspector.
Upvotes: 0
Reputation: 31339
The same code working for me fine !!!!!!
Please check the Internet Connection.
Please check the
NSData *data
sizePlease check the UIImageView Size
Please check it hided by some other controls
Please check it added properly to your View
Please check its Content View
@property(nonatomic,retain) IBOutlet UIImageView *imageview;
NSURL *url = [NSURL URLWithString:@"http://www.scri8e.com/effects/FL0WERZ/PNG/ir09.png"];
NSData *data = [[NSData alloc]initWithContentsOfURL:url ];
UIImage *img = [[UIImage alloc]initWithData:data ];
self.imageview.image=img;
Upvotes: 1