警告视图 注销按钮时候的操作
作者:
行如蝼蚁 | 来源:发表于
2018-05-30 03:14 被阅读0次//注销按钮时候的操作
- (IBAction)logOutButClick:(UIBarButtonItem *)sender {
//创建UIalercontroller对象
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示确定注销吗?" message:@"取消" preferredStyle:UIAlertControllerStyleActionSheet];
/** UIAlertActionStyleDefault = 0, 默认
UIAlertActionStyleCancel, 取消
UIAlertActionStyleDestructive 销毁
*/
// 创建确实按钮
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
//回到上个控制器
[self.navigationController popViewControllerAnimated:YES];
}];
// 创建取消按钮
UIAlertAction *cancle = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
//把这两个按钮添加到提示框中
[alertVC addAction:ok];
[alertVC addAction:cancle];
//弹出提示框
[self presentViewController:alertVC animated:YES completion:nil];
}
本文标题:警告视图 注销按钮时候的操作
本文链接:https://www.haomeiwen.com/subject/rmwzjftx.html
网友评论