UIAlertController使用

时间:2017-01-05 08:58:20   收藏:0   阅读:179
    //1创建弹框控制器
    UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:@"亲,确定要滚吗?" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    //2.1添加确定事件
    UIAlertAction *sureBtn = [UIAlertAction actionWithTitle:info style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
        // 回到登录界面
        [self.navigationController popViewControllerAnimated:YES];
    }];
    [alertVc addAction:sureBtn];
    //2.2添加取消事件
    UIAlertAction *cancelBtn = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        NSLog(@"---点击了取消按钮");
    }];
    [alertVc addAction:cancelBtn];
    //3展示控制器
    [self presentViewController:alertVc animated:YES completion:nil];

 

原文:http://www.cnblogs.com/dzq1991/p/6251041.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!