UIScrollView 定点放大,并禁用捏合/捏合

发布于 12-29 16:50 字数 641 浏览 5 评论 0原文

我遇到了 UIScrollView 的问题,

我希望当用户点击特定点时缩放滚动视图,并阻止用户使用捏缩放手势放大/缩小,我该怎么做?

[imgScroll setDelegate:self];
float minimumScale = [imgScroll frame].size.height  / [imageView frame].size.height;
[imgScroll setMinimumZoomScale:minimumScale];
[imgScroll setZoomScale:minimumScale];

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [imageView viewWithTag:ZOOM_VIEW_TAG];}


- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
[scrollView setZoomScale:scale+0.01 animated:NO];
[scrollView setZoomScale:scale animated:NO];}

提前谢谢。

i'm stuck on a problem with UIScrollView

i wanna the scroll view be zoomed when the user tap on a specific point, and prevent the user to zoom in/out using Pinch Zoom Gestures, how can i do it?

[imgScroll setDelegate:self];
float minimumScale = [imgScroll frame].size.height  / [imageView frame].size.height;
[imgScroll setMinimumZoomScale:minimumScale];
[imgScroll setZoomScale:minimumScale];

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [imageView viewWithTag:ZOOM_VIEW_TAG];}


- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
[scrollView setZoomScale:scale+0.01 animated:NO];
[scrollView setZoomScale:scale animated:NO];}

thx in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瑶2025-01-05 16:50:45

我禁用了 UIScrollView 中的缩放属性,检查了 Interface Builder 中触摸部分下的所有属性。

I was disable the zoom propriety in the `UIScrollView, checked all the propriety under the touch section in Interface Builder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文