提示框的设置

1.一般设置两个选项

UIAlertController  *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"密码修改成功" preferredStyle:UIAlertControllerStyleAlert];
 [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
 [self.navigationController popViewControllerAnimated:YES];
}]];
 [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
      取消按钮做什么,在这里写
}]];
[self presentViewController:alert animated:YES completion:nil];

2,第二种方法

 UIAlertController *alert =[UIAlertController alertControllerWithTitle:@"提示标题" message:@"提示信息" preferredStyle:UIAlertControllerStyleAlert];
        
UIAlertAction *alert1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        取消的操作
 }];
 UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
          确定的操作
}];
[alert addAction:alert1];
[alert addAction:alert2];
[self presentViewController:alert animated:YES completion:nil];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容