I'm handling a pinch gesture, and I am scaling a UILabel
like开发者_如何学Python this:
CGFloat factor = sender.scale;
view.transform = CGAffineTransformScale(view.transform, factor, factor);
The problem is when I zoom-in (make the label larger) it wont redraw itself, i.e. it becomes blurry. How do I make it sharp again?
The reason this happens is that transforms are applied to the rendered bitmap of the view's layer.
If you want to have the label's contents scaled adjust the contentsScale, too:
CGFloat scaleFactor = ...
view.layer.contentsScale = [UIScreen mainScreen].scale + scaleFactor;
view.transform = CGAffineTransformMakeScale( scaleFactor, scaleFactor );
精彩评论