search

Home  >  Q&A  >  body text

objective-c - How to modal a UIAlertController in the active method of Appdelegate.m

How to modal a UIAlertController in the active proxy method of Appdelegate.m?

You can ignore the error message, the main problem lies in the last part

高洛峰高洛峰2825 days ago588

reply all(1)I'll reply

  • 怪我咯

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

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

    reply
    0
  • Cancelreply