views:

28

answers:

1

hi everybody

I am new to iphone development. in my application i want to extract image from image tag from xml and then display it in left of table cell my code is

the xml tag of image is

<image>http://192.168.1.239/japantube/thumb/570.jpg&lt;/image&gt;

now i in my code i have parse it in such form

 int blogEntryIndex1 = [indexPath indexAtPosition: [indexPath length] -1];
NSString *imgstring =[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"image"];

now the path of image is store in image string what i am going to do is to extract the image from path and display it in left of cell which i am trying

cell.imageView.image=[UIImage imageNamed:imgstring];

when i run my application it crash down can anybody help me out em very upset due to that error thanks in advance

A: 

imageNamed: is used to retrieve images that are stored in your application's bundle as resources. If you want to load an image using a url, then you will need to download the image and then use imageWithData:

To download the image and get its data, use NSURLConnection. There is some good sample code provided by apple that will show you how to do this.

Chris Garrett
Dear chris thanks for reply can u send me some sample codeand as there any way to that with out downloading because its rss application what i am going to do as just to show the small tumbnil of image with title in left of cell.
Nauman.Khattak
Do you mean that you want to have the image included into your app? Or do you mean that you don't want to write the code for the downloading?
Chris Garrett