简体   繁体   中英

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.

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.

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 .

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM