iOS

UIAlertController : UIViewController

 UIAlertController *alertContr = [UIAlertController alertControllerWithTitle:@"提示信息" message:@"確定要註銷?" preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

     //确定

        [self performSegueWithIdentifier:@"BackLoginView" sender:nil];

    }];

    

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

        //取消

     

    }];

    

    //添加操作(順序:上下順序)

    [alertContr addAction:cancelAction];

    [alertContr addAction:okAction];

    

    //呈現警告視圖

    //[self presentViewController:alertContr animated:YES completion:nil];

    [aletContr show];

喜欢请赞赏一下啦^_^

微信赞赏

支付宝赞赏

原文地址:https://www.cnblogs.com/share-iOS/p/6426908.html