ahsan
ahsan

Reputation: 677

how to make UITableView scrolling faster?

I have a UITableView with custom cells. Each cell has 2 UIImageView and 2 UILables. I have like a few hundred of these cells.

The scrolling of the table seems to be slower. The images used or not very big in size and are cached.

Is there any way to make it more efficient/faster ?

Thanks.

Upvotes: 3

Views: 1422

Answers (2)

mskw
mskw

Reputation: 10358

Make sure you have not used any layer functions for the images or the views. For example, the layer.cornerRadius property for the images would drastically slow down your scrolling. There are custom rounded corner functions that won't slow down your table from here http://blog.sallarp.com/iphone-uiimage-round-corners/.

I know I'm making guesses, but this can be useful.

Upvotes: 2

Raj
Raj

Reputation: 6025

i think you added imageView and label everytime in tableview cell loading, do your cell operation like addSubview only if(cell==ni) , this will make the scrolling faster

      static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier:CellIdentifier] autorelease];
[cell addSubview:yourImage1];
[cell addSubView:yourImage2];//this will do only if cell first time create .

    }

Upvotes: 0

Related Questions