ios - ScrollView 中的 UIButton 没有响应

标签 ios swift uiscrollview uibutton

我有一个 ScrollView 和其中的容器 View 。 UIButtons 位于容器 View 内部。 当我运行程序时,位于 ScrollView 末尾的 UIButtons 无响应。 UITextFields 是响应式的。 然而,在调整框架后,我确保 UIScrollView 和容器 View 的 origin 和 hightXwidth 都匹配。我用打印语句检查了它。 一些设置:

scrollView.isExclusiveTouch = true
scrollView.delaysContentTouches = false
scrollView.isUserInteractionEnabled = true

ScrollView 的内容大小:

let hightForScrollMenu: CGFloat = 120
scrollView.contentSize = CGSize(width: scrollView.frame.size.width, height: scrollView.frame.size.height+hightForScrollMenu)

输出 View : enter image description here

检查时:

viewInsideScrollView.frame.size.height = scrollView.frame.size.height
print("Zhenya: ScrollView's frame height is:\(scrollView.frame.size.height) and its origin is \(scrollView.frame.origin)")
print("Zhenya: ViewInsideScrollView's frame heigt is: \(viewInsideScrollView.frame.size.height) and its origin is \(scrollView.frame.origin)")

enter image description here

View Controller 属性:

enter image description here

主视图属性和约束:

enter image description here

enter image description here

ScrollView 属性和约束:

enter image description here

enter image description here

容器 View 属性和约束:

enter image description here

enter image description here

最佳答案

容器 View 是红色 View ?嗯,那么显然按钮在它的外面。其 super View 之外的按钮是不可点击的。

关于ios - ScrollView 中的 UIButton 没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41772877/

相关文章:

ios - 使用未解析的标识符 'AVPlayer'

ios - 检测 UIScrollView 上的触摸位置?

ios - XCode 5 和 Kiwi/XCUnit 的单元测试问题和崩溃

ios - Storyboard 中的 View 在 iPhone 6 上无法正确调整大小

iphone - 邀请 Twitter 好友获取应用

ios - 无法将 '__NSDictionaryM' (0x1f0c63860) 类型的值转换为 'NSString' (0x1f0c70290) Swift

ios - 如何找出两个自定义单元格中的哪一个被选中?

ios - 从存档中解压缩单个文件

ios - Swift 中的 ScrollView 和 View 层次结构

ios - UIScrollView 嵌入其他 UIScrollView