Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView subclass itself gets pixelated in retina

I have an UIView subclass which is loaded in a UIViewController when needed. This view works fine in iPhone 3/4/5 or seems working fine. It also looks okay in iPad 1/2. But for iPad retina screen, the view is pixelated. All the labels, button, view background, texts are pixelated.

Earlier I did not override the drawRect method. But with some other SO hints I did that. But still did not solve the problem.

Any idea, where's the problem with retina display?

like image 639
karim Avatar asked Dec 20 '25 09:12

karim


1 Answers

Ok, I figure out the problem.

The view uses a kinds nested view, and one of the view layer was manipulated and called the

layer.shouldRasterize = YES;

But if I add this line, that fixes the problem.

layer.rasterizationScale = [UIScreen mainScreen].scale;

In the apple WWDC 2012 they have a video on this. "Polishing Your Interface Rotations". Here they discussed the issue. https://developer.apple.com/videos/wwdc/2012/

like image 98
karim Avatar answered Dec 22 '25 22:12

karim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!