ios - 取消按钮在自定义操作表中不可点击

标签 ios swift swift4

引用链接UIAlertController - add custom views to actionsheet 我的 UI 布局。

我的应用程序中有相同的自定义操作表布局。代码也是这样写的。我注意到在 swift4 中“取消”按钮不执行任何操作。当我点击下面代码中的“取消”按钮时

let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {(alert: UIAlertAction!) in 
     print("Cancel")
})

代码:print(Cancel")不执行。

最佳答案

我认为您的自定义 View 框架有问题。
在模拟器上运行您的应用程序并按“调试 View 层次结构”:
enter image description here
之后,您可以检查 View 框架。

关于ios - 取消按钮在自定义操作表中不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46701807/

相关文章:

arrays - 如何在 UIPickerView 中显示所需的行?

ios - (quickblox) 如何将人员添加到聊天对话框?

ios - 保存由结构体对象数组组成的 Realm 列表

ios - UIImageView 对齐

ios - 使用iOS处理/缩小高分辨率图像

objective-c - 标签未更改为自定义字体

swift - header Logo 在 Swift 4/XCode 9/iOS 11 上大小错误

ios - 变量不会填充 plist 数据,Swift

ios - 使用 iOS13 使用 NFC 读取 eID 信息时遇到问题

ios - 单元测试: Emulate that user has specific calendar