iOS的警告用法示例 (UIActionSheet不让用之后,iOS8.3以后)
UIAlertController
UIAlertController *VC = [UIAlertController alertControllerWithTitle:@"是否取消?" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *loginOutAction = [UIAlertAction actionWithTitle:@"注销" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
// 点击注销按钮会做一些事
[self.navigationController popViewControllerAnimated:YES];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
// 把按钮添加进controller
[VC addAction:loginOutAction];
[VC addAction:cancelAction];
// 让警告显示出来
[self presentViewController:VC animated:YES completion:nil];
// 显示在中间的alert(警告)
UIAlertView *ok = [[UIAlertView alloc] initWithTitle:@"是否取消" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"注销", nil];
[ok show];
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。