Zoom Core Graphics in UIScrollView

2019-07-20 21:25发布

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条回答
手持菜刀,她持情操
2楼-- · 2019-07-20 22:20

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.

查看更多
登录 后发表回答