Anjaneyulu Anjaneyulu - 9 months ago 48
iOS Question

Faster way to load an image from a URL and display it in an iPhone app

I am using the following code to display an image in my ImageView:

imgbackBG.image = [UIImage imageWithData:
[NSData dataWithContentsOfURL:
[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [test.arrImagessplash objectAtIndex:[test.arrImages count]-4]]]]];

The problem is that the code executes very slowly. Is there a way to load the image and display it in the ImageView more quickly? If so, how can I do this?


Download the Files from here.....

and use as the following way:

AsyncImageView *asyncImageView = [[AsyncImageView alloc]initWithFrame:CGRectMake(30,32,100, 100)];   
[asyncImageView loadImageFromURL:[NSURL URLWithString:your url]];
[YourImageView addSubview:asyncImageView];
[asyncImageView release];