简体   繁体   English

关闭UIScrollView的滚动功能,但保持缩放功能

[英]Turn off scrolling for a UIScrollView but keep zooming functionality

I have a UIScrollView and I want to turn off scrolling but I also want to keep the zooming functionality. 我有一个UIScrollView ,我想关闭滚动功能,但我也想保留缩放功能。

When I make scrollView.scrollEnabled = NO , it turns off scrolling but zooming is also gone. 当我使scrollView.scrollEnabled = NO ,它关闭了滚动,但缩放也消失了。

The documentation says: 该文件说:

When scrolling is disabled, the scroll view does not accept touch events; 禁用滚动时,滚动视图不接受触摸事件;否则,滚动视图将停止。 it forwards them up the responder chain. 它将它们转发到响应者链。

You could try to set the UIScrollView 's contentSize to it's bounds to effectively disable scrolling? 您可以尝试将UIScrollViewcontentSize设置为bounds以有效地禁用滚动吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM