简体   繁体   中英

Cannot Present View Controller From App Delegate

I need to present view controller from App Delegate I did it by the following code:

MyViewController *controller = [[MyViewController alloc] init];
[self.window.rootViewController presentViewController:controller animated:YES completion:NULL];

Application Shows Black Screen. How can I do that?

You need to set RootViewController of window as :

MyViewController *controller = [[MyViewController alloc] init];

[self.window setRootViewController:controller];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM