首页 > 其他 > 详细

UIAlertController简单使用

时间:2018-07-10 14:09:50      阅读:210      评论:0      收藏:0      [点我收藏+]

UIAlertView   在iOS2 的时候开始使用,在iOS9 的时候被摒弃

NS_CLASS_DEPRECATED_IOS(2_0, 9_0, "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead") __TVOS_PROHIBITED

 

由UIAlertController替代

常用使用方法

    UIAlertController *alertvc = [UIAlertController alertControllerWithTitle:@"提示" message:@"表视图封装" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //要执行的操作
    }];
    [alertvc addAction:sureAction];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //要执行的操作
        
    }];
    [alertvc addAction:cancelAction];
    
    [self  presentViewController:alertvc animated:YES completion:nil];

 

UIAlertController简单使用

原文:https://www.cnblogs.com/OIMM/p/9288624.html

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