[英]Cancel Button is not tappable in custom action sheet
Refer to link UIAlertController - add custom views to actionsheet for my UI layout. 请参阅链接UIAlertController-为我的UI布局向操作表添加自定义视图 。
I have the same layout of custom action sheet in my app. 我的应用程序中的自定义操作表布局相同。 The code is written in the same way.
代码以相同的方式编写。 I noticed that in swift4 the "Cancel" button does not perform any action.
我注意到在swift4中,“取消”按钮不会执行任何操作。 When I tap on "Cancel" button in code below
当我点击下面代码中的“取消”按钮时
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {(alert: UIAlertAction!) in
print("Cancel")
})
The code: print(Cancel")
does not execute. 代码:
print(Cancel")
不执行。
Try this handler 试试这个处理程序
UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in
print("cancel")
}))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.