UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlert

  UIAlertController * cancleAlertController = [UIAlertController alertControllerWithTitle:nil message:@"你确定退出登录?" preferredStyle:UIAlertControllerStyleAlert];

    

//    第一种添加方法

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

        

        NSLog(@"点击取消");

        

    }]];

 

  //    第二种添加方法

    UIAlertAction * otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

        NSLog(@"点击确定");

        

    }];

    

    [cancleAlertController addAction:otherAction];

    //弹出视图

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

posted @ 2016-04-14 16:36  iOS张文权  阅读(1239)  评论(0编辑  收藏  举报