ios - 我的 ScrollView 中的最后一个按钮无法注册触摸

标签 ios swift uiscrollview uibutton

我有一个带按钮的 ScrollView 。显示器上哪些按钮可以触摸,但在按钮(滚动)中不能触摸

我的代码:

let screenSize = UIScreen.mainScreen().bounds
let randomXPos = CGFloat(arc4random_uniform(UInt32(screenSize.width)))
self.scrollView.contentSize = CGSizeMake(randomXPos, 1370)
self.scrollView.delaysContentTouches = true

iphone 6 的屏幕截图

enter image description here

enter image description here

最佳答案

请使用 View 调试器检查您的 View ,并确保您的按钮位于 ScrollView 内。有时,如果您调整 ScrollView 的内容大小,按钮可能会从 ScrollView 中消失。

关于ios - 我的 ScrollView 中的最后一个按钮无法注册触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37327442/

相关文章:

ios - 通过对象数组过滤 API 请求响应?

ios - 如何在 UIScrollView 滚动到 maxY 时触发动画? swift

objective-c - 如何在用户停止触摸屏幕的地方停止 uiscrollview 滚动

java - 将 iOS 应用程序转换为 Android 应用程序

ios - iPhone App 中的 UIApplicationDelegate 从未调用过回复

iOS - 在 UIView 中检测触摸?

ios - 有没有办法使用 Foursquare API 按价格搜索 field ?

ios - swift:在 Collection View 中的标签中显示进度

ios - 为什么我的 UIScrollView 中的 UIView 不滚动?

ios - 部署外部企业应用程序