在UIScrollView中关闭缩放 [英] Turn off Zooming in UIScrollView

查看:1482
本文介绍了在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屋!

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