缩小 UIScrollView 中的大 UIImageView
案例:我有一段简单的代码,用于在 UIImageView->UIScrollView 中显示/缩放/滚动大图像。在此 UIScrollView 内容中,我想放置按钮来创建可单击区域。
问题:当我放大时,质量仍然正常,但是当我缩小到可能的最高级别时,图像变得虚线,并且一些线条不再可见。
尝试:我尝试在 kCGInterpolationHigh 上重新生成具有插值质量的 UIImage,并尝试在每次缩放更改后更改图像的大小。正如您可能会看到的那样,没有结果喷射。
Case: I have a simple piece of code for displaying/zooming/scrolling a large image in an UIImageView->UIScrollView. In this UIScrollView content I want to place buttons to create clickable areas.
Issue: When I zoom in the quality remains proper but, when I zoom out to the highest posible level than the image is getting dotted and some lines aren't visible anymore.
Tried: I tried to regenerate the UIImage with Interpolation Quality on kCGInterpolationHigh and tried to change the size of the image after every zoom change. As you might aspect, no results jet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您使用
CATiledLayer
作为支持层,如 Apple 的 PhotoScroller 示例应用程序所示。这允许您预先构建缩放版本,这意味着您可以使用 Photoshop/ImageMagick/GIMP 等精确控制插值质量,而不是依赖 UIScrollView 的内置缩放。I suggest you use a
CATiledLayer
as the backing layer, as demonstrated by Apple's PhotoScroller sample app. This allows you to prebuild the scaled versions, meaning you can precisely control the interpolation quality with Photoshop/ImageMagick/GIMP etc, rather than relying on UIScrollView's built-in scaling.