首页 > 其他 > 详细

UIAlertController类--alert弹框2(Destructive “警示”)

时间:2015-11-18 10:24:55      阅读:291      评论:0      收藏:0      [点我收藏+]

一、效果

技术分享

 

二、实现

 

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

    [self alertTest2];

}

 

/**

 *  Destructive :“警示”样式

 */

- (void)alertTest2

{

    //1.创建UIAlertController

    UIAlertController *alertController = [UIAlertController

                                          alertControllerWithTitle:@"标题"

                                          message:@"这个是UIAlertController的默认样式"

                                          preferredStyle:UIAlertControllerStyleAlert];

    //2.创建UIAlertAction实例

    

    /**

     “警示”样式的按钮:红色按钮,用在可能会改变或删除数据的操作上

     */

    UIAlertAction *destructiveAction = [UIAlertAction actionWithTitle:@"重置" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {

        

    }];

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

        

    }];

    

    //3.UIAlertAction实例添加到UIAlertController

    [alertController addAction:destructiveAction];

    [alertController addAction:cancelAction];

    

    //4.显示对话框视图控制器

    [self presentViewController:alertController animated:YES completion:^{

        

    }];

    

}

UIAlertController类--alert弹框2(Destructive “警示”)

原文:http://www.cnblogs.com/M-Y-P/p/4972541.html

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