UILabel Pinch-to-zoom

I handle the pinch gesture, and I scale UILabelas follows:

CGFloat factor = sender.scale;
view.transform = CGAffineTransformScale(view.transform, factor, factor);

The problem is when I zoom in (zoom in shortcut), it will not be redrawn, i.e. becomes blurry. How to make it sharp again?

+5
source share
1 answer

The reason for this is that transformations are converted to rendering a bitmap image of the view layer.

If you want the contents of the shortcut to scale, also change the contentsScale value:

CGFloat scaleFactor = ...

view.layer.contentsScale = [UIScreen mainScreen].scale + scaleFactor;
view.transform           = CGAffineTransformMakeScale( scaleFactor, scaleFactor );
+2
source

All Articles