I am using the code below to create a splash screen image. The only problem I am running into is that the view then appears 20 pixels below the top of the of screen. Upon inspecting the properties of the appFrame, I can see that the origin and the height are incorrect. When I load my next view, it adds to that 20 pixels and becomes 40 pixels! What am I doing wrong here? What is causing the 20 pixel gap?
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
UIView *view = [[UIView alloc] initWithFrame:appFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.view = view;
splashImageView_ = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"splashpage.png"]];

the frame for the main screen is relative to its superview, so it includes a 20px offset for the status bar. When you set that as your frame, you are saying that your view should be have an origin 20px below the top of its superview
you should set the frame of your view as the bounds of the screen
you can set the "Status bar Initially Hidden" Property to "YES" in Info.plist file in your Application.
iOS will take it off for you and readjust your screen size
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With