Since Xcode 5 and iOS 7 the default appearance of a UINavigationBar is black translucent. This even affects the same app running in iOS 6. Black opaque is deprecated and can no longer be set in Interface Builder.
However, you can set the appearance for all nav bars by putting this little gem in your App Delegate’s didFinishLaunchingWithOptions method:
Note that iOS 7 devices are affected differently by this change: only the icon/text colour will change into your specified colour, but the bar itself will remain translucent. Using black means text buttons are barely readable. Hence, a version check would be appropriate:
// changes the colour of all navigation bars on iOS 6 and lower
You can hide (and show) navigation bars and toolbars from your UINavigationController with extremely funky animations, much like we see in the Photos app on iOS. In the app, when you single-tap the screen, both top and bottom toolbars disappear.
Here’s how we do that: Provided you have your view controller embedded in a UINavigationController, you can call the following methods to slide the top and bottom bars in and out:
Some things are really easy to do via a Storyboard – but when you want to create the same thing in code I frequently forget how to do it.
Turns out it’s equally simple: this example assumes you have a View Controller which is embedded in a Navigation Controller (so it already has a UINavigationBar at the top). Here’s how you add a button to it, set the title and target, and tell it what to do when it’s pressed:
// first we create a button and set it's properties
The back button (and its text) is only displayed in the NEXT view controller on the stack. So changing the back button in the detail view controller for example doesn’t change what’s displayed when the detail view controller is displayed. You must change it one step earlier, in the master controller’s navigation bar.