美文网首页
提示框的设置

提示框的设置

作者: 禅牧 | 来源:发表于2016-09-18 17:43 被阅读18次

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];

相关文章

网友评论

      本文标题:提示框的设置

      本文链接:https://www.haomeiwen.com/subject/ydlgettx.html