0

I'm new to making apps for iOS and this problem has been bugging me for hours now. Screenshot of Interface Builder The navigation bar in the modal popover view (on the right) doesn't properly extend to the top of the screen, like it does in other apps. I know that I could just disable Autolayout and do something like CGFloat newheight = self.InfoNavigationBar.frame.size.height + 20; [self.InfoNavigationBar setFrame:CGRectMake(0, 0, 320, newheight)];, but I'd like to do this with Autolayout enabled, if at all possible. Right now, the view looks like this when viewed on my iPhone:

Screenshot of app on device

How can I make it properly extend to the top of the screen, leaving the status bar on top of it? It'd be nice if this could be done in IB, without having to resort to doing all this in code.

(Edit: A few other iOS-related questions on SO suggest that IB and Storyboards are two different things. I don't even know which is which, take a look at the first screenshot, I'm using whatever that is.)

Peter W.
  • 2,323
  • 4
  • 22
  • 42

1 Answers1

0

Apparently it's sufficient to override your UINavigationBar's positionForBar method like so: https://stackoverflow.com/a/18968920/1058399 It still feels like a dirty hack, but until there's a better way, I'll be doing that.

Edit in case any newbies like me read this: All of this falls apart when you want your app to support landscape modes. Navigation bars are supposed to be smaller in landscape mode, which is done for you automatically if you wrap your view in a Navigation Controller. Don't just place navigation bars and expect them to "just work".

Community
  • 1
  • 1
Peter W.
  • 2,323
  • 4
  • 22
  • 42