开发者

Pinch-to-zoom UILabel

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 );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜