美文网首页
UIAlertController

UIAlertController

作者: 安红唯CC | 来源:发表于2018-03-20 15:33 被阅读6次

    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:@"message" preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];

        [alertController addAction:cancelAction];

        UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

        }];

        [alertController addAction:OKAction];

        [self presentViewController:alertController animated:YES completion:nil];//在一般controller里面

    [self.window.rootViewController presentViewController:alertController animated:YES completion:nil]; //在APPdelegate里面

    相关文章

      网友评论

          本文标题:UIAlertController

          本文链接:https://www.haomeiwen.com/subject/wtdbqftx.html