Zoom Core Graphics in UIScrollView

时间秒杀一切 提交于 2019-12-11 00:47:17

问题


I was wondering which would be the best way to scale my Core Graphics drawings as I zoomed in using a UIView subclass within a UIScrollView.

Currently when I zoom in, the drawing becomes slightly fuzzy - I know this is correct functioning, I just want to know how developers override it to keep the image sharp...

Thanks!

(P.s. I have heard about using Core Animation, but I don't know where to start on that huge library with scary names haha!)


回答1:


The simplest way is to use supersampling. Basically, create your image at a larger resolution than it's displayed at, and scale it down for display (UIImageView will scale it for you). Then when you zoom in, it will simply be scaling back up to the original resolution.

The downside to this approach is you can't scale your image up too large or it will take up too much memory.



来源:https://stackoverflow.com/questions/4964083/zoom-core-graphics-in-uiscrollview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!