tags:

views:

31

answers:

1

Hi all,

I'm new to iphone dev, i'm just trying to get something done.

I do my first XML parser App. When my app launches i set a tableView with a custom cell. There is in the custom cell two labels and one image.

When the table view is launched i call my custom cell method which take the string od the image's adress and then make an url with it, a nsdata from the content of an url than i create my image with the content of this data.

But my table view is really really slow even on simulator.

what is the best way to display images on iphone via the internet ? ? i know they have to be in a png format but even with png it is too slow

thanks for all

i use :

>     NSURL *imgUrl = [NSURL URLWithString:_text]; 
>       NSData *imgData = [NSData dataWithContentsOfURL:imgUrl]; 
>       limage.image = [UIImage imageWithData:imgData];
+1  A: 

Is your image saved at its final resolution? Say you want to display a 25x25 pixel image in the table, is the file saved as a 25x25 image or is it saved as some higher resolution? This will cause some slowness. However you should be loading the image in a background thread so that when scrolling the scrolling isn't holding up waiting for the image to load. Remember that doing network transfer to get the image is most likely the longest part of the process. You should also cache the image in some way instead of just assigning the image to the limage.image property. This way it won't redownload the image each time it redraws the cell.

Edit

Also you don't have to use PNG images for the pictures in the table cells. You can use regular JPG or GIF images if you want. The image format used should be what ever format is appropriate for the type of image content you will have. You only have to use PNGs for the icons, and splash screens, although it is preferred to use PNG in all embedded resources.

jamone
Yes, there's no way around loading the images asynchronously, in particular for table views.
Codo