Graphics Reference
In-Depth Information
//set text shadow
cell. textLabel . backgroundColor = [ UIColor clearColor ];
cell. textLabel . layer . shadowOffset = CGSizeMake ( 0 , 2 );
cell. textLabel . layer . shadowOpacity = 0.5 ;
//rasterize
cell. layer . shouldRasterize = YES ;
cell.layer.rasterizationScale = [UIScreen mainScreen ].scale;
return cell;
}
We are still drawing the layer content offscreen, but because we have explicitly enabled
rasterization, Core Animation is now caching the result of that drawing, so it has less of a
performance impact. We can verify that the caching is working correctly by using the Color
Hits Green and Misses Red option in the Core Animation tool (see Figure 12.13).
Figure 12.13 Color Hits Green and Misses Red indicates caching works.
Search WWH ::




Custom Search