I want to change the height of my UINavigationBar and add a title using XCode6…This navigation bar is a separate object I placed inside of a view controller on the storyboard. Why cant I change the title or stretch it from the editor? It would be so awesome if i could just do that…but I CANT! Can somebody please point me in the right direction for how to do this programmatically in Swift? Is it best practice for this code go in the viewDidLoad? Also…is it best practice for me to even put a UINavigationBar on a View Controller? What is the advantage of using a UINavationContoller versus scrapping together my own version which I’m doing. It’s really easy to just put buttons on a navigation bar….why would I put a bar button item? It seems like the easiest thing to do is create a a nice title bar as an image in photoshop and put buttons on top of it in the editor, rather than wrestle with Interface Builder objects…am I wrong?
Sorry about ranting this is not a good question…maybe the question should be…Should I make a navigation bar in photoshop and put buttons on it instead of deal with navigation objects? I only use simple push segues with buttons for my navigation right now.
2
Answers
If you want a very custom look, you have to make your own. Based on what you want (custom height) — check this out Is there a way to change the height of a UINavigationBar in Storyboard without using a UINavigationController?
The advantages of the built in one are:
More here: apple documentation on customizing the nav bar
You can use the
UINavigationItem
navigationItem property inUIViewController
to customize yourUINavigationBar
.