0

If I setup rasterization as following:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *const cellIdentifier = @"UITableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    cell.layer.shouldRasterize = YES;
    cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
    cell.textLabel.text = exampleTitles[indexPath.row];

    return cell;
}

As far as I know, the system should create a image cache for each distinct cell. But what if every cell's title is different? How does the system works to decide which cached image can be used for specific cell?

xi.lin
  • 3,326
  • 2
  • 31
  • 57

1 Answers1

0

After watching of session 419 on WWDC14, I found there are two rules:

  • the cache size for rasterization is limited to 25.5 times of the screen size

  • the rasterized images are evicted from the cache if they are unused for more than 100ms

And doing profile on iPhone 6P show that only current screen will be cached.

xi.lin
  • 3,326
  • 2
  • 31
  • 57