I never rely on [[UIScreen mainScreen] applicationFrame] , especially during application startup.
When creating views in code, use the supervisor to set the frame.
If you use xibs with "simulated interface elements", they will be the right size and everything will work fine.
UINavigationController Based Applications
In the case of a UINavigationController based application, capture the frame directly from self.navigationController.view , do not try to use [self loadView] and self.view.superview . The UINavigationController uses “hidden” routines to accomplish this task - therefore, direct browsing will not work.
The UINavigationController is special because during the launch of the application, the navigation controller resizes your views after calling loadView . When autoresistant strokes in you end with a small margin at the bottom of the screen.
Why not UIScreen
[[UIScreen mainScreen] applicationFrame] does not work reliably (especially when running the application in the landscape). My experience is that the viewcontroller interfaceOrientation property will not match the orientation of the applicationFrame .
bentford Oct 29 2018-10-29 13:45
source share