Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 739
Taskinul Haque Avatar asked Dec 13 '13 17:12

Taskinul Haque


3 Answers

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?

like image 26
FuzzyBunnySlippers Avatar answered Oct 23 '22 03:10

FuzzyBunnySlippers


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.

like image 172
progrmr Avatar answered Oct 23 '22 03:10

progrmr


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).

like image 20
Travis Avatar answered Oct 23 '22 01:10

Travis