views:

1473

answers:

1

I am new to developing on the iPhone so am sorry if this is an easy question, but it has had me stumped for a little while.

Basically the app displays data retrieved from an XML feed. In that feed is an element that contains the path to an image. eg http://www.myserver.com/myimage.jpeg.

I want to be able to display that image in the list view of my iPhone app.

Most importantly, I don't want to stop the list drawing for each image, the rest of the data should be displayed immediately and then each image downloads and displays as quickly as data speed etc make it available.

What is the best way of downloading that image and displaying it?

Ideally can someone point to some working example code.

Thanks Stephen

+1  A: 

Displaying the image: you could create a UIWebView and just point it to the path - and then it's fully zoomable too.

Displaying in the list view:

//Somehow download your image...
cell.image = Your Image
Isaac Waller
Thanks Isaac. Does that mean that UIWebView can have used to populate an image variable, not just an on screen object?
Stephen Baugh
I don't think you can just get a UIImage from a web view, but you could take a snapshot of the UIWebView: http://stackoverflow.com/questions/501496/take-snapshot-of-view-webview-programmatically/501506#501506 And then use that as cell.image. I think it automatically scales to fit.
Isaac Waller
Thanks Isaac. I'll give it a try. Cheers Stephen
Stephen Baugh