码迷,mamicode.com
首页 > 移动开发 > 详细

ios 9 UIAlertController 代替 UIAlertView

时间:2016-01-06 11:24:49      阅读:137      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!