ios - 触摸手势在 Scrollview 中不起作用(Xcode、Swift)

标签 ios swift xcode uiscrollview scrollview

我尝试在 ScrollView 中使用按钮。 但它们并不是“触手可及”的。

我的没有 ScrollView 的应用程序正在运行。

我检查了是否启用了用户输入,但确实如此。

希望有人能给我建议。

问候

enter image description here

最佳答案

设置UIScrollView的以下属性以启用UIButton的触摸事件

scrollView.isUserInteractionEnabled = true
scrollView.isExclusiveTouch = true
scrollView.canCancelContentTouches = true
scrollView.delaysContentTouches = true

关于ios - 触摸手势在 Scrollview 中不起作用(Xcode、Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54688404/

相关文章:

ios - 如何在 Scenekit 中确定几何表面的方向

swift - 围绕注释叠加

ios - 由于 RealmSwift,当 swift 3 @obj 推理设置为 "default"时,应用程序崩溃

iphone - 为什么 UIKit 中有这么多方法将 View 连接到事件?

ios - 在 IOS 中,在 "Edit Mode"中,如何将带有单元格的新部分添加到静态 UITableView?

ios - 单元格背景颜色清除插入行时的奇怪行为

ios - 使用 Swift 在 SpriteKit 中复制()节点

swift - 如何将类型为 Class<Class Implementing Protocol> 的值存储在类型为 [String :Class<Protocol>] in Swift? 的字典中

ios - UICollectionViewCell 在 collectionview 的多个单元格中看到的一个更改

iphone - Xcode - 如何更改应用程序/项目名称 : what do I need to to update and check?