Custom navigation bar in Xcode 4? - uinavigationbar

I'm pretty new to Xcode and me and my buddy are working on a golf app we tought would be cool to use for ourselves. I've done a tab bar with 3 view controllers and one navigation bar controller with 2 view controllers. Now, first of all the bar on top is named navigation ITEM and not navigation BAR, so i can't change things like color and button type, all i can change is the title.
Does anyone know if you can just remove that bar completely or just customize it so it's just a picture i made instead? I dont really need it since you could just press one of the tabs in the tabbar to go back.
Sorry if things doesnt make sense, i'm a total noob. Also i tried search the web and all i could find was some youtube clip from xcode 1.2 and i tried it but it didn't work..

You could make your custom nav bar in photoshop or similar, add it as image view and add custom buttons on top of that.

Related

Weird Fade On Navigation Bar

I was messing around on the IB on Xcode, and I some how got a fade on the navigation bar (take a look here). The color is whiter/lighter on the top part of the navigation bar and gets darker until the bottom of the navigation bar. I don't know how to return it back to a "solid" color (i.e. remove the gradient).
Anyone know how to accomplish this?
There are several ways. I don't know if this issue exists when you run the project so I will cover all the bases.
Here are some suggesstions:
Delete the Navigation Controller and embed your View Controller in a new Navigtaion Controller. The easiest way is to select your View Controller, go to the top navigation where you can see File, Edit, View, etc. and select Editor -> Embed In -> Navigation Controller.
In your viewDidLoad() you can set the colour of your navigation controller like so:
navigationController?.navigationBar.barTintColor = UIColor.blue
In your story board, you can select the Navigation Controller scene and select the Navigation Bar and play around there, however the above 2 would be preferred.
If you want the gradient at run time, see this answer: https://stackoverflow.com/a/43637829/4008175
I am making the assumption that you have not created a custom navigation bar class with an #IBDesignable element. I also have a feeling that when you run the project, the gradient won't be present, but since that is not mentioned, I would be ok if I am wrong.
See how these solutions work for you.

UIBarButton placed in toolbar instead of UINavigationBar

I'm developing a (so far) simple iOS application using storyboards.
At one place in the storyboard, I have:
Navigation controller -> Table View (prototype content) -> Regular view
The "regular view" is accessed from a + (PLUS) button in the navigationbar in the table view. In the "regular view" I would like to have a save button in the NAVIGATION BAR. However, when I drag it from the object library to the "regular view" it appears in the TOOLBAR (at the bottom of the screen) instead of in the NAVIGATION BAR. I have not found a way to move it, or found any settings where I can change it. I'm not sure if there is something constraining me from putting a button there or if XCode just mess with me. (I'm new to iOS programming)
Notes:
In the "regular view", I have a back button and a title. According to the design guides I should be able to have one more button.
Thanks for any help!
If anyone faces this problem, I did the following:
I couldn't add a Bar button because there were no top bar in that view. First I tried to put a Navigation Bar in the view, but Xcode crashed. Then I tried to put a Navigation Item, which worked. After that I could place my bar button in the top bar.
What I don't understand is why I could put the Add (+) button in the previous view, since that doesn't have any navigation entry either, but I'm guessing it's since that view was the root view controller of a Navigation Controller. Someone else can maybe give a more detailed answer.
There isn't any solution for this so far. There are however some workarounds for this problem.
Check this pretty cool answer by #Shimanski:
https://stackoverflow.com/a/20419513/2082569
& also this by #ecotax:
https://stackoverflow.com/a/17019667/2082569

iOS. Navigation controller toolbar - customize example

I'm newbie with Xcode, I'm learning it and trying to make my app.
Now I would like to put Navigation Bar func at the bottom of the screen with some customize.
I turn on "Shows Toolbar" at Navigation Controller and put my button there, but I cannot customize it.
Everything that I found about customizing Navigation Bar at the top of the screen or about customizing TabBar when people are talking about bottom of the screen.
Please, can you give me a code examples to build something like this at the bottom of the screen:
https://dl.dropboxusercontent.com/u/1338320/nav.png
Thanks in advance!
I'm not sure what you are trying to customize (button or bar) but when there is a bar at the bottom of the screen that is not a tab bar it is a tool bar not a navigation bar. The two are related but they each have their own class. Tool bars use UIToolBar not UINavigationBar. The tool bar is independent of the navigation controller and the two work together well. For any views that don't want a tool bar just set it to hidden in -viewDidAppear: (you will need to un hide it in views that use it).
dimimpou is right. You can accomplish this by using a UITabBarViewController and one UIBarButtonItem for "ADD ONE" and "MY STATS".
If you get lost in references(I sometimes get lost too), I may provide a simple example.
Note that if the interface provided by UIKit doesn't meet your need you can:
Use category over UITabBar or UITabBarItem.
If 1. doesn't work sadly you'll have create your own view controller which is simulate UITabBarViewController(requires some time, but it's worth)
Edit:
You can use a UINavigationController inside a UITabBarViewController.
You can easily do this. The way I understand it, you want this "Toolbar" to show from a button in the navigation bar. Just put a tab bar with what you need and make it show when the user presses the button on the navigation bar. on this buttons action put this code: self.tabBar.hidden = NO; and on the storyboard uncheck the bar visibility option. Hope it helps!

Single navigation bar in iOS tabbed app

I'm doing iPhone tabbed application, but I need to use navigation bar also (just for app title and single icon for Settings in the corner) like twitter did: link. I have 4 tabs in my app too. I was wondering is there any chance to create only one navigation bar, so when I want to change it, I will change it only in one place?
I was looking at this tutorial, but there are two "Navigation Bar" objects. And I would like to have single object that will appear in every tab.
Right now I created tabbed app and manually added navigation bar item into first tab. Then I copied it into others. It works ofc, but I'm not sure about that solution:/
Your use of separate navigation controllers for each tab isn't a bad solution.
Setting up the navigation bar and its items in only one place is also a good idea. To achieve this, you could always have your view controllers derive from a custom view controller that overrides navigationItem.

Navigation bar tutorial

First, sorry for my bad English. I'm really beginner at App development and I'm doing an app with three views.
The first and the second ones are switched by a Tab Bar (and that's all right so far).
The first it's gonna be the only one which leads to the third view (which will be only a image) through a Navigation Bar.
This nav bar in the first view will have one button to go to the third view, and in the third view the nav bar will have a button "back" (and here's the problem).
I'm putting a nav bar in the first view and I try to put a Nav item into it, but they don't let me! How can I do it ? I can't find a good Navigation Bar's tutorial whithout storyboard (I'm not using storyboards...).
Thank you.
take a look at these two tutorials
http://fuelyourcoding.com/how-to-add-buttons-to-your-ios-app-navigation-bar/
and
http://www.idev101.com/learn/navigation_controllers.html

Resources