Question

i need to shrink the height of a UINavigationBar (attached to the UINavigationController)

i've done this via the UINavigationControllerDelegate's navigationController:didShowViewController method, and it's working fine.

the problem is the visible viewcontroller that's in the main view. it wasn't resizing itself to reflect the new navbar height. thus, the didShowViewController method also resizes the viewcontroller's view frame, which works fine.

however, when i go to push on a new ViewController, or pop, i always see the view shift down to the original position during the animated transition to the next view. then, due to the code i have in the didShowViewController in the NavControllerDelegate, it shifts it back up.

i'm curious as to the best way to ensure that the shift down never happens.

i tried placing the code that resizes the frame into the willShowViewController, but that doesn't do anything.

i've also made sure that the UIView's frame that is the view of the UIViewController that's being popped, is also of the proper/shifted dimensions. no go there.

it's like i need to intercept the drawing actions after the pushViewController is invoked, and before the UINavigationController's didShowViewController is called.

i've been staring at my code for hours & hours... not getting anywhere. hopefully this makes sense to someone out there.

thanks!!!

Was it helpful?

Solution

Another option I think would be to set the NavigationControllers navigationBarHidden equal to YES. This will hide the nav bar completely and then you can then draw whatever view you want in the place the bar would have resided. Just put controls on the view that wrap the navigation methods (push, pop, etc...). It might be a challenge to get it to have the same style as a nav bar though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top