【问题标题】:Zoom Loupe on UIImageViewUIImageView 上的放大镜
【发布时间】:2010-10-27 14:52:58
【问题描述】:
有谁知道如何在 iPhone 上的 UIImage 视图中实现 UITextField 的缩放放大镜功能?
我正在构建的应用程序的一部分允许用户在 UIImage 上画一条线,这个过程可能涉及点的精确定位。为了帮助用户,我想提供将光标定位在 UITextField 中时所见的缩放放大镜。有谁知道如何做到这一点?任何指向相关文档的指针?
干杯!
【问题讨论】:
标签:
iphone
uiimageview
accessibility
uiimage
loupe
【解决方案1】:
我不知道任何相关文档。
当实现这样的事情时我会做什么。在视图上显示视图的 UIImage 表示。然后将覆盖 UIImage 剪辑到您要放大的视图部分。您可以使用 CGAffineTransformScale 放大该部分。
您可以使用 CALayer 的 renderInContext: 方法将现有视图绘制到 UIImage。
UIGraphicsBeginImageContext(self.view.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage *imageRepresentation = UIGraphicsGetImageFromCurrentImageContext();