iOS. Navigation controller toolbar - customize example - ios

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!

Related

Navigation Item in XIB file is not visible

I'm in XCode 7.2.1 and I am trying to make a view that is reusable and should have some custom elements in the navigation bar.
If I would add a view to my storyboard, connect it via a segue to the navigation controller and make sure there is a "Navigation Item" in the view, I could see the navigation bar and edit my items in it.
If I manually add a Navigation Item to a XIB however I can't see anything. Even if I switch in the simulated metrics settings Top Bar to something else than Inferred or None.
I don't want to use the storyboard, if possible. Is there a descent way to make the navigation item visible and edit it?
Thanks in advance.
I don't think you link your View Controller correctly with Navigation Controller. When you link it, you should choose with root View Controller. If you link it correctly, you don't have to add NavigationItem manually.
By the way, you shouldn't do the customization for Navigation bar directly in xib. All you can do is only to set the Title, Prompt and Back Button text.
Do it in code! I think you won't have different styles for navigation bar in different views, right? That would be too silly.

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 Bar VS UIToolBar

According to Apple's "Human Interface Guidelines" - Navigation bars should only have one other button (apart from the standard back button)
All this is fine, but there are several apps which have numerous buttons on the top Navigation bar, such as the Facebook app (Image)
My question / discussion arises from here. . .
1) Would apple accept the use of a UIToolBar in place of a Navigation bar (with a custom "back" button", which would act as a replacement for the Navigation Bar:
2) Is this how Facebook would have achieved their top bar?
3) IF I could use a toolbar instead of a Navigation Bar, i would have a small space at the top where the toolbar would overlap the "status bar" - how should i overcome this issue? -
- would placing a A UIView, in that position with an embedded Toolbar be the correct solution to this issue?
All your help / comments / guides are very much appreciated
You don't have to show the navigation bar, it can be hidden (see setNavigationBarHidden:animated:). You can use UIToolbar instead but there are a lot of options for customizing the navigation bar.
You can set the leftBarButtonItem, the titleView, or the rightBarButtonItem to be a custom view as specified in the UINavigationController class reference. Those properties take a UIBarButtonItem but that doesn't have to be a button. You can create a UIBarButtonItem using initWithCustomView: to create a UIBarButtonItem with any UIView. It can be a UIView that has multiple buttons as subviews or a search bar or segmented control or whatever views you need as long as they fit and don't violate the HIG. You can do that with any of the 3 custom views on the navBar.
1) Would apple accept the use of a UIToolBar in place of a Navigation
bar (with a custom "back" button", which would act as a replacement
for the Navigation Bar:
My advice, when faced with a "should I possibly violate the specification by working around it and hoping they don't mind" decision, is "no". Are you willing to spend the time to change the code to the meet the spec if they don't accept it?
2) Is this how Facebook would have achieved their top bar?
I'm not sure this is answerable.
3) IF I could use a toolbar instead of a Navigation Bar, i would have
a small space at the top where the toolbar would overlap the "status
bar" - how should i overcome this issue? - - would placing a A UIView,
in that position with an embedded Toolbar be the correct solution to
this issue?
I created an App with a Tool Bar AND a Navigation Bar. See the screen shots (Review page) here. The Tool Bar is at the top, beneath the navigation bar. At one point, I added a feature to make a tap on the navigation bar hide/show the tool bar. But since the longer displays came out, I have removed it. Most users don't really seem to mind the extra small hit at the top as long as the display provides the information they need.
Was this helpful?
1) Probably. I've not seen or heard of an example of Apple bothering to reject an app that used a toolbar rather than a navigation controller. However, you may get a reviewer having a bad day that decides to reject your app for that reason; it's really impossible to know for sure, but unlikely. I will say that I've submitted an app that looks similar to apps with a navigation controller but the top bar is custom, and it was accepted.
2) The Facebook top bar is most likely totally custom. You can see that the transparency effect is unlike the standard navigation bar's transparency, and the layout is not similar to any standard apple control.
3) Align your top bar (however you do it) with the topLayoutGuide in interface builder (or in code).

Hiding tab bar on one view in Xcode storyboard

I have a Tab bar application where I would like to hide the tab bar for one of the views to exchange it with a toolbar. I am using Storyboard and by setting the Bottom Bar to None and dragging in a toolbar this looks the way I would want it on the storyboard.
But when I run it the Tab bar doesn't go away.
I had the same question but ended up finding my correct answer here
Essentially, you can hide the tab bar for certain view controller by checking the 'Hide bottom bar on push' check box (in the view controllers attributes inspector in the storyboard).
This might not answer all, and might not be compatible with =< iOS 5, etc, but it helped me and I hope it helps others who come here.
Thanks, and good luck!
It wont work because it only simulate the view when the tabbar is hidden. If you want to hide tabbar you have to do it programmatically.
See this answer Iphone: Is it possible to hide the TabBar?
and try to use hideTabbar method in viewWillAppear, and showTabbar in viewDidDisapear.

Custom navigation bar in Xcode 4?

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.

Resources