在UIScrollView中关闭缩放 [英] Turn off Zooming in UIScrollView
问题描述
有没有人知道在使用UIScrollView时暂时关闭缩放的方法?
Does anyone know a way to temporarily turn off zooming when using a UIScrollView?
我看到你可以使用以下方法禁用滚动:
I see that you can disable scrolling using the following:
self.scrollView.scrollEnabled = false;
但是我没有看到类似的缩放命令。有什么想法?
but I'm not seeing a similar command for zooming. Any thoughts?
推荐答案
如果你想禁用用户缩放手势的能力,那么在iOS 5及以上版本中你可以禁用捏手势。这仍然允许您从代码控制滚动视图...
If you want to disable the user's ability to zoom through gestures then in iOS 5 and above you can disable the pinch gesture. This still allows you to control the scroll view from code...
scrollView.pinchGestureRecognizer.enabled = NO;
类似于pan ......
similarly for pan...
scrollView.panGestureRecognizer.enabled = NO;
必须在中调用 - (void)viewDidAppear:(BOOL)animated
或更高版本,否则系统将其重置为启用。
This must be called in - (void)viewDidAppear:(BOOL)animated
or later as otherwise the system resets it to enabled.
这篇关于在UIScrollView中关闭缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!