tags:

views:

42

answers:

1

Hi i want to get image faster from website in iphone..

Now i get image from website url using this function

NSData *data;
UIImage *Favimage;
data = [NSData dataWithContentsOfURL:[NSURL URLWithString:WebsiteUrl]];
Favimage = [[UIImage alloc]initWithData:data];

But it takes some time to get image from website url. Now i want get faster image means ? What can i do ? Is there any api in apple iphone sdk?

Can any one help me ?

Thanks in advance.....

+2  A: 

Time taken to download isn't in your control; it's a function of the network.

The correct answer is to use asynchronous downloads so that your application doesn't block while the download is taking place. That way your user interface can still respond.

To make an async download, you need to use NURLConnection, and implement the delegate methods to accept data. See the sample code LazyTableImages and SimpleURLConnection.

Paul Lynch