iOS - UIAlertController

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];

posted @ 2017-02-21 23:18  Wind678  阅读(167)  评论(0编辑  收藏  举报