self.window.rootViewController vs window addSubview

后端 未结 5 634
一向
一向 2020-12-05 04:17

I\'ve noticed a lot of examples for iPhone apps in the Application Delegate

- (void)applicationDidFinishLaunching:(UIApplication *)application

h

5条回答
  •  既然无缘
    2020-12-05 04:27

    I use this code:

        rootViewController_ = [[RootViewController alloc] initWithFrame:[UIScreen mainScreen].bounds];
        window_ = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        if ([window_ respondsToSelector:@selector(setRootViewController:)]) { // >= ios4.0
            [window_ setRootViewController:rootViewController_];
        } else { // < ios4.0
            [window_ addSubview:rootViewController_.view];
        }
    

提交回复
热议问题