UIScrollView ZoomToRect 与 setZoom
如果我有一个 UIScrollView,并且我想放大某个位置,那么仅在滚动视图上设置缩放
self.scrollView.zoomScale = MY_NEW_ZOOM;
与计算缩放内的新矩形进行放大和使用
zoomToRect:
Thanks.之间有什么区别吗?
If I have a UIScrollView, and I want to zoom in on a location, is there any difference between just setting the zoom on scrollview like
self.scrollView.zoomScale = MY_NEW_ZOOM;
versus calculating a new rectangle within the zoom to zoom in on, and using
zoomToRect:
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
zoomScale
仅设置缩放比例,不会更改内容偏移量。zoomToRect:
将更改缩放比例和内容偏移量,以便您给定的矩形可见。zoomScale
just sets the zoom scale and doesn't change the content offset.zoomToRect:
will change the zoom scale and the content offset such that the rect you have given will be visible.需要注意的是,您可能需要确保在 ZoomToRect: 中传递的矩形的大小是滚动视图框架的大小。否则,缩放和内容偏移可能不会达到您预期的位置。
Just as a heads up, you may want to ensure that the size of the rect you pass in zoomToRect: is the size of the scrollview's frame. Otherwise the Zoom and Content Offset might not end up where you expect it.