首页 > 移动平台 > 详细

ios 9 UIAlertController 代替 UIAlertView

时间:2016-01-06 11:24:48      阅读:178      评论:0      收藏:0      [点我收藏+]

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"" preferredStyle:(UIAlertControllerStyleAlert)];

        

       

        UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {

            NSLog(@"注意学习");

        }];

        

        

        

        

        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction *action) {

            // 点击按钮后的方法直接在这里面写

            NSLog(@"注意学习");

        }];

        

        

        

            // 创建警告按钮

            UIAlertAction *structlAction = [UIAlertAction actionWithTitle:@"警告" style:(UIAlertActionStyleDestructive) handler:^(UIAlertAction *action) {

                NSLog(@"注意学习");

            }];

        

        

        [alertController addAction:okAction];

        [alertController addAction:cancelAction];

        [alertController addAction:structlAction];

        

        [self presentViewController:alertController animated:YES completion:nil];

        

ios 9 UIAlertController 代替 UIAlertView

原文:http://www.cnblogs.com/xzguo/p/5104645.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!