“Application windows are expected to have a root view controller” conditional appearance

笑着哭i 提交于 2019-12-02 04:51:17
Nikita P

Set window.rootViewController property .

Add the following code to your delegate.h and delegate.m files.

AppDelegate.h

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) YourViewController *viewController;

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[YourViewcontroller alloc] initWithNibName:@"YourViewcontroller" bundle:nil] autorelease];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

Hope it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!