iOS中UIAlertView怎么用

这篇文章主要介绍iOS中UIAlertView怎么用,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联是一家专业提供七星关区企业网站建设,专注与成都做网站、网站制作、H5技术、小程序制作等业务。10年已为七星关区众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。

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

大概意思是说9以后用UIAlertController代替UIAlertView,9以前还是UIAlertView

double version = [[UIDevice currentDevice].systemVersion doubleValue];//判定系统版本。

    if(version>=9.0f){

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

        [alertController addAction: [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

            NSLog(@"确定");

        }]];

        [alertController addAction: [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

            NSLog(@"取消");

        }]];

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

    }else{

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定",@"取消", nil];

        [alertView show];

    }

#pragma mark UIAlertView 点击事件

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 9_0){

    NSLog(@"%@",@(buttonIndex));

}

以上是“iOS中UIAlertView怎么用”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


分享标题:iOS中UIAlertView怎么用
文章出自:http://lszwz.com/article/gseoph.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款