IOS8以上的UIAlertView

在iOS8以前,我们都习惯性用UIAlertView去做提示框,iOS8以后,苹果提倡使用UIAlertController取代UIAlertView。

创新互联主要业务有网站营销策划、成都网站设计、成都网站制作、微信公众号开发、微信小程序H5建站、程序开发等业务。一次合作终身朋友,是我们奉行的宗旨;我们不仅仅把客户当客户,还把客户视为我们的合作伙伴,在开展业务的过程中,公司还积累了丰富的行业经验、营销型网站建设资源和合作伙伴关系资源,并逐渐建立起规范的客户服务和保障体系。 

#define SYSTEM_VERSION   [[UIDevice currentDevice].systemVersion floatValue]



if (SYSTEM_VERSION >= 8.0) {
                    UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:@"赎回成功" message:nil preferredStyle:UIAlertControllerStyleAlert];
                    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                        [self.navigationController popViewControllerAnimated:YES];
                    }];
                    [alertCtrl addAction:okAction];
                    [self presentViewController:alertCtrl animated:YES completion:nil];
                    
                }else{
                //这个else一定要写,否则会导致在ios8一下的真机crash
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"赎回成功" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
                    alert.tag = 998;
                    [alert show];
                }


#pragma mark-UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (alertView.tag == 998) {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

当前题目:IOS8以上的UIAlertView
当前网址:http://bzwzjz.com/article/joeosg.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设 成都网站制作 成都网站制作 成都网站建设公司 盐亭网站设计 定制网站制作 手机网站建设 成都网站设计 定制网站设计 商城网站建设 网站制作 重庆手机网站建设 响应式网站设计方案 营销型网站建设 网站制作 重庆企业网站建设 成都网站建设公司 响应式网站设计 移动网站建设 成都网站建设 成都企业网站建设公司 成都网站建设