如何解雇UIAlertController
当点击外部时UIAlertController
?
我可以添加一个UIAlertAction
风格的UIAlertActionStyleCancel
驳回UIAlertController
.
但我想添加当用户点击外部时的功能UIAlertController
the UIAlertController
会解雇。怎么做?谢谢。
添加带有样式的单独取消操作UIAlertActionStyleCancel
。这样当用户点击外部时,您就会收到回调。
Obj-c
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alert Title" message:@"A Message" preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
// Called when user taps outside
}]];
雨燕5.0
let alertController = UIAlertController(title: "Alert Title", message: "A Message", preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: {
action in
// Called when user taps outside
}))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)