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?

Community
  • 1
  • 1
RileyE
  • 10,874
  • 13
  • 63
  • 106
  • 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? – Nas Banov Nov 07 '13 at 05: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. – RileyE Nov 07 '13 at 05:53

1 Answers1

1

Set UIViewController.edgesForExtendedLayout to UIRectEdge.None

Edges For Extended Layout

Larry OBrien
  • 8,484
  • 1
  • 41
  • 75
  • Unfortunately, that doesn't seem to affect my content at all. Also, I am setting the `UINavigationBar` to hidden. – RileyE Sep 19 '13 at 20:06
  • 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. – RileyE Sep 19 '13 at 20:31
  • Try additionally setting `UIViewController.extendedLayoutIncludesOpaqueBars` to `YES` – Larry OBrien Sep 19 '13 at 20:51
  • 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 `UIViewController`s. The navigation bar remains over top of the content. – RileyE Sep 19 '13 at 21:05
  • 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. – RileyE Sep 24 '13 at 21:22