捏合缩放 UILabel
我正在处理捏合手势,并且正在缩放 UILabel,如下所示:
CGFloat factor = sender.scale;
view.transform = CGAffineTransformScale(view.transform, factor, factor);
问题是当我放大(使标签更大)时,它不会重新绘制自身,即它变得模糊。怎样才能让它再次锋利呢?
I'm handling a pinch gesture, and I am scaling a UILabel
like 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发生这种情况的原因是变换应用于视图层的渲染位图。
如果您想让标签的内容缩放,也可以调整contentsScale:
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: