UIAlertControllerd的使用

来源:互联网 发布:excel表格数据取整 编辑:程序博客网 时间:2024/06/13 23:47

UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:nilmessage:@"重新登录"preferredStyle:UIAlertControllerStyleAlert];

    [alert addAction:[UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleCancelhandler:^(UIAlertAction *_Nonnull action) {


        //点击确定后执行这里面的代码


    }]];


    [self.navigationControllerpresentViewController:alert animated:YEScompletion:nil];



//注:completion,顾名思义-->完成,结束,实现。completion参数一般是个代码块Block,完成之后/结束之后/实现之后的代码块;不需要做任何操作可置空nil。

//注:handler也是个代码块

0 0
原创粉丝点击