Zooming an UIView without losing detail

Let's say I have a complex UIView , which is initially on the screen with quite small frame, let's say 80x80.

One of its subviews is an UIImageView displaying an image whose actual resolution is 1024x1024.

When the user tap the UIView i want the view to zoom in almost full screen so that the user can better see the image.

I know already how to scale a UIView to zoom in, my question is the following.

What's the best way to zoom in this view without pixellating the image?

I thought of these options:

  • I can actually set the frame of the UIView to the full screen size, and normally scale it down, so I'm sure that when it's zoomed in, it will be perfectly detailed. This solution anyway have a strong performance issue, cause moving around many of these scaled down views, will be quite an hit on the CPU/GPU.

  • I can do it just as I described, so small frame and scale > 1 to zoom in, but in this case will the image be displayed without pixellating?

  • I can actually set the frame to redisplay the view at the big/small size. In this case the detail will be good, but I have a performance hit here too, because my UIView have around 15 subviews that need complex calculation to relayout, so it's not so "fast" to set the frame.

  • Which is the best solution? Or do anybody have any other better solution?


    为什么不只是缩略图表示是80x80 ,当用户点击任何缩略图时,您new view使用+transitionFromView:toView:duration:options:completion:方法简单地从包含所有缩略图的当前视图切换到new view 。将全分辨率图像加载到新视图中显示UIImageView :)

    链接地址: http://www.djcxy.com/p/82006.html

    上一篇: 创建CGRect并将其分配给for循环中的UIView

    下一篇: 在不丢失细节的情况下缩放UIView