Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance scrolling and retina resolution images in CALayer

Tags:

ios

iphone

I have a UIView that is placed as a subview in a UIScrollView. I have several child views made up of images, text, and buttons in the UIView. In order to get decent scrolling performance I set shouldRasterize = YES on the layer in the UIView. This worked great in that performance increased so I have smooth scrolling and doesn't pose an issue since my graphics are static once drawn. However, the problem is that when I set shouldRasterize that the rasterized graphics are blurry and low resolution on a Retina display. Is there a way to have high resolution graphics that are rasterized for performance?

like image 291
Jamie Hamick Avatar asked Dec 17 '10 22:12

Jamie Hamick


1 Answers

Seems I needed to set rasterizationScale to the proper value for the device as follows.

myView.layer.rasterizationScale = [[UIScreen mainScreen] scale]; 
like image 152
Jamie Hamick Avatar answered Sep 29 '22 09:09

Jamie Hamick