UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"你是否确认退出登陆状态" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
} ];
UIAlertAction *ser = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[self.navigationController popViewControllerAnimated:YES];
}];
[alert addAction:ser];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil];IOS 8.1以后的弹出框代码
最新推荐文章于 2025-08-04 10:32:33 发布
本文展示如何使用 Swift 在 iOS 应用中创建一个带有两个选项(取消和确定)的弹出对话框来确认用户是否要登出。通过 UIAlertController 类实现,并演示了如何设置样式、消息、按钮及操作。

2846

被折叠的 条评论
为什么被折叠?



