简体   繁体   中英

iOS5: UITableView poor scrolling performance

First of all I am getting memory leak while scrolling tableview out of bounds. The same issue as here .

Also, my scroll is fast enough but it 'kind of trembles' while I scroll it. The cells are reusable.

Code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    Country *country=[[self.items objectAtIndex:[indexPath section]] objectAtIndex:[indexPath row]];
    CountryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.imageView.image=[UIImage imageNamed:country.countryFlag];
    cell.countryName.text=country.countryName;
    cell.currencyCode.text=country.code;
    cell.currencyOriginalName.text=country.originalUnitName;

    return cell;
}

App: iOS 5, ARC, Storyboard.

What can be the real reason of this tableView behavior and how to fix it?

If your scrolling is poor in the device, you probably haven't configured your subviews correctly in the prototype. You aren't doing anything expensive in your method above.

Use the Core Animation instrument (device only) - check your frames per second when scrolling. You want as close as 60fps as possible.

Turn on "color blended layers" - anything drawn transparent will be highlighted in red. You want to remove all transparency, if possible, from your cells, and make them all green. This may simply be a matter of setting background colours and the opaque flag correctly in your prototype subviews.

If your images are not the same size as your image view, then you will be resizing every time a cell appears, this is an expensive operation as well.

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