I have a navigation controller which I don't want to use up the whole screen. In particular, I want to put a logo image in a bar at the top of the screen. Unfortunately, the navigation controller doesn't seem to be designed this way. In interface builder, I can't make it take up part of a screen. How would you achieve the effect of a logo image up the top and a navigation controller taking up the rest of the screen?
Asked
Active
Viewed 411 times
1 Answers
2
I haven't done this myself, but it should be pretty straight-forward. You'll need a wrapper view controller to be its parent (let's call it MyWrapperViewController), and its view hierarchy might ultimately look something like this:
UIView -+ (hooked up to the view outlet in MyWrapperViewController)
|
+-- UIView (Your logo goes here)
|
+-- UIView (The "child" navigation controller's view)
The logo view can be a UIView, or a UIImageView, or whatever class is appropriate for the content.
When you create a UINavigationController somewhere for your MyWrapperViewController class, you can resize its view bounds to something smaller than full-screen (perhaps the size of the screen minus the size of your logo, with an appropriate origin offset so it's below the logo), and then add it as a subview.
Shaggy Frog
- 27,575
- 16
- 91
- 128
-
This mostly worked, but I ran into an issue with the top UIView [overlapping the status bar](http://stackoverflow.com/questions/3767066/layered-uiviewcontrollers-overlaps-status-bar) – Casebash Sep 23 '10 at 00:34