Zoomable图形 [英] Zoomable Graphics

查看:134
本文介绍了Zoomable图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将可缩放的图形绘制到屏幕上。我目前在ScrollView中有一个UIView,我想知道最好的方法是处理/实现我在屏幕上绘制的图形缩放。

I am trying to draw zoomable graphics onto the screen. I currently have a UIView inside of a ScrollView and I'm wondering what the best way is to go about handling/implementing zooming of the graphics I've drawn on the screen.

推荐答案

您可能希望使用我在答案中描述的内容此处

You'll probably want to use something along the lines of what I describe in my answer here.

在缩放变焦事件期间,变换将应用于您的UIView,它将缩放内容但会导致模糊。缩放事件完成后,使用 -scrollViewDidEndZooming:withView:atScale:委托方法确定新的比例因子,并适当调整大小并重新渲染UIView。如果你在UIView的 -drawRect:方法中使用Core Graphics进行绘图,那么这应该很容易管理。

During the pinch-zooming event, a transform will be applied to your UIView, which will zoom the content but will lead to blurring. Once the zooming event is finished, use the -scrollViewDidEndZooming:withView:atScale: delegate method to determine the new scale factor and resize and re-render your UIView appropriately. If you're doing your drawing using Core Graphics within the -drawRect: method of your UIView, this should be pretty easy to manage.

这篇关于Zoomable图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆