cari

Rumah  >  Soal Jawab  >  teks badan

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

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

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

高洛峰高洛峰2757 hari yang lalu539

membalas semua(1)saya akan balas

  • 怪我咯

    怪我咯2017-05-02 09:26:06

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

    balas
    0
  • Batalbalas