objective-c - 如何在Appdelegate.m的 active方法中modal出一个UIAlertController

 手机用户2502870941 发布于 2022-10-25 09:48

如何在Appdelegate.m的 active的代理方法中modal出一个UIAlertController?

报错信息大家可以忽略,主要问题就在最后一块儿

1 个回答
  • //初始化UIAlertController

    UIAlertController *alertCtl = [UIAlertController alertControllerWithTitle:@"提示" message:@"AppDelegate中" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
    [alertCtl addAction:alertAction];
    //初始化UIWindows
    UIWindow *aW = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    aW.rootViewController = [[UIViewController alloc]init];
    aW.windowLevel = UIWindowLevelAlert + 1;
    [aW makeKeyAndVisible];
    [aW.rootViewController presentViewController:alertCtl animated:YES completion:nil];
    2022-10-26 23:01 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有