我必须禁用滚动视图上的滚动,因此它只能由软件而不是用户滚动。
scrollView.isUserInteractionEnabled = false
这个滚动视图有一些视图,他们有TapGesture
,我启用了他们的交互:
view.isUserInteractionEnabled=true
但除非我在滚动条上启用交互,否则它不会工作。还有其他方法可以实现我的目标吗?
不要isUserInteractionEnabled
用于禁用 tableView 上的滚动。使用isScrollEnabled
而不是,isUserInteractionEnabled
您不需要更改视图的任何内容
scrollView?.isScrollEnabled = false;
如果您设置isUserInteractionEnabled
为false
,它将忽略对 的子视图的触摸tableView
,无论isUserInteractionEnabled
子视图是true
还是false
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句