self.window.rootViewController vs window addSubview

后端 未结 5 640
一向
一向 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条回答
  •  旧时难觅i
    2020-12-05 04:37

    My Opinion:

    self.window.rootViewController will resize the rootViewController.view according to status bar height

    But if you use addSubview it won't

    For example, if you setRootViewController to a NavigationController, the navigationController would be (0,0,320,480);

    but if you setRootViewController to a common UIViewController, the navigationController would be (0,0,320,460);

    if you use addSubview: the two viewcontrollers would be (0,0,320,480)

    And if there is an In-call-StatusBar. it also change for you when you use setRoot... if you use addSubview, the subview size wouldn't change

    do some test with different view border color

提交回复
热议问题