0

I've seen the answers on each of these questions:

Status bar appear over my view's bounds in iOS 7

Status bar and navigation bar appear over my view's bounds in iOS 7

New iOS 7 statusBar leaves a range 20px in apps compiled in Xcode 5

iOS 7 status bar back to iOS 6 default style in iPhone app?

However, none of those answers seem to work for me. I am trying to show the status bar in the "Black Opaque" style, as I have set in the .plist.

Is there any way to have the application continue to work as if the status bar wasn't included in the window?

I've tried this:

CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; self.window = [[UIWindow alloc] initWithFrame:CGRectMake(0.0f, statusBarHeight, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - statusBarHeight)]; 

However, statusBarHeight is 0 in application:didFinishLaunchingWithOptions:. And manually setting it to 20.0f seemed to just screw up the UIWindow and the UIViewControllers would be taller than the screen. (Also, manually setting the value 20.0f feels dirty)

What am I missing?

EDIT

I should also point out that I am using a UINavigationController that hides it's UINaviationBar.

EDIT 2:

This only seems to be an issue for the application while debugging or in Ad Hoc (Test Flight) release. The exact same application on the App Store shows the status bar as it should. Why is this affecting debug and ad-hoc releases?

2
  • Your "edit 2" is curious - the app behaving differently from appstore vs ad-hoc. My guess would be that as part of the submission, some script on AppStore side overrode some properties inside the package. Download the .ipa with itunes, compare content for differences? Commented Nov 7, 2013 at 5:50
  • @NasBanov It was. It was switching SDKs that were used. TestFlight used the iOS 7 SDK, but the App Store used the iOS 6 SDK, as iOS 7 was not out at the time. Commented Nov 7, 2013 at 5:53

1 Answer 1

1

Set UIViewController.edgesForExtendedLayout to UIRectEdge.None

Edges For Extended Layout

Sign up to request clarification or add additional context in comments.

5 Comments

Unfortunately, that doesn't seem to affect my content at all. Also, I am setting the UINavigationBar to hidden.
I'm an idiot. I was setting that to the wrong UIViewController. I was setting it to the UINavigationController's rootViewController. However, will I also have to set something to the frame, as it currently continues to include the UIStatusBar as a part of the controller.
Try additionally setting UIViewController.extendedLayoutIncludesOpaqueBars to YES
That also doesn't work. I'm not using Interface Builder, either. This is all using code. I am not setting the UIWindow size to anything other than the UIScreen bounds, as when I try to shrink it, it only pushes the window down and doesn't affect the height of the UIViewControllers. The navigation bar remains over top of the content.
This does seem to work while the UINavigationController's UINavigationBar isn't set to hidden. When it is hidden, such as when using a custom navigation bar, both of those options seem to not have any effect.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.