Questions tagged [uinavigationbar]

The UINavigationBar class implements a control for navigating hierarchical content in iOS. It’s a bar, typically displayed at the top of the screen, containing buttons for navigating up and down a hierarchy. The primary properties are a left (back) button, a center title, and an optional right button. You can specify custom views for each of these. The most common way to use a navigation bar is in conjunction with a UINavigationController object

A navigation bar enables navigation through an information hierarchy and, optionally, management of screen contents. A navigation bar is contained in a navigation controller, which is an object that manages the display of the hierarchy of custom views. A navigation bar appears at the upper edge of an application screen, just below the status bar.

A navigation bar usually displays the title of the current screen or view, centered along its length. When navigating through a hierarchy of information, users tap the back button to the left of the title to return to the previous screen. Otherwise, users can tap content-specific controls in the navigation bar to manage the contents of the screen.

All controls in a navigation bar include a bezel around them, which, in iOS (), is the bordered style. If you place a plain (borderless) control in a navigation bar, it automatically converts to the bordered style.

A navigation bar can be translucent or opaque. If the bar is translucent, the top edge of the main content view meets the bottom edge of the status bar, so that users can see the content behind the navigation bar. If the bar is opaque, the top edge of the main content view meets the bottom edge of the navigation bar.

On iPhone (), changing the device orientation from portrait to landscape can change the height of the navigation bar automatically. On iPad (), the height and translucency of a navigation bar does not change with rotation.

On iPhone, a navigation bar always displays across the full width of the screen. On iPad, a navigation bar can display within a view, such as one pane of a split view, that does not extend across the screen.

References:

6208 questions
192
votes
21 answers

How to add a right button to a UINavigationController?

I am trying to add a refresh button to the top bar of a navigation controller with no success. Here is the header: @interface PropertyViewController : UINavigationController { } Here is how I am trying to add it: - (id)initWithNibName:(NSString…
Artilheiro
  • 4,005
  • 10
  • 36
  • 34
172
votes
16 answers

Achieving bright, vivid colors for an iOS 7 translucent UINavigationBar

iOS 7.1 UPDATE: Looks like the workaround for modifying the alpha channel in the UINavigationBar has been ignored in this update. Right now, the best solution seems to be to just 'deal with it' and hope that whatever color you choose can render a…
SpacePyro
  • 3,121
  • 4
  • 25
  • 30
163
votes
11 answers

Navigation bar show/hide

I have an app with a navigation bar consisting of 2 bar buttons. I would like to hide and show this navigation bar when a user double taps the screen. Initially, the navigation bar should be hidden. When a user double taps the screen, the navigation…
Shishir.bobby
  • 10,994
  • 21
  • 71
  • 100
161
votes
15 answers

Programmatically get height of navigation bar

I know that the presence of the more view controller (navigation bar) pushes down the UIView by its height. I also know that this height = 44px. I have also discovered that this push down maintains the [self.view].frame.origin.y = 0. So how do I…
user420479
157
votes
29 answers

How to remove border of the navigationBar in swift?

i've been trying to remove the navigationBars border without luck. I've researched and people seem to tell to set shadowImage and BackgroundImage to nil, but this does not work in my case. My code …
Peter Pik
  • 11,023
  • 19
  • 84
  • 142
151
votes
23 answers

Transparent iOS navigation bar

I'm creating an app and i've browsed on the internet and i'm wondering how they make this transparent UINavigationBar like this: I've added following like in my appdelegate: UINavigationBar.appearance().translucent = true but this just makes it…
Peter Pik
  • 11,023
  • 19
  • 84
  • 142
143
votes
14 answers

Warning frame for "Navigation bar" will be different at run time appears in Xcode 8 Swift 3

Before I've upgraded to Xcode 8 I haven't seen this error in such case. I have different Navigation Controllers. For all of them I see an error Frame for "Navigation bar" will be different at the run time. Navigation bar "Expected: width=384,…
Danny
  • 3,975
  • 4
  • 22
  • 35
136
votes
11 answers

Seeing black bars at the top and bottom of the iPhone X Simulator

Running my App in the iPhone X Simulator (GM Seed) I am noticing two strange effects: the App does not use the full screen space (top and bottom area is black) a strange white bar beneath the title bar Does anybody know what is happening here and…
Darko
  • 9,655
  • 9
  • 36
  • 48
129
votes
20 answers

Imitate Facebook hide/show expanding/contracting Navigation Bar

In the new iOS7 Facebook iPhone app, when the user scrolls up the navigationBar gradually hides itself to a point where it completely vanishes. Then when the user scrolls down the navigationBar gradually shows itself. How would you implement this…
El Mocoso
  • 1,400
  • 3
  • 9
  • 7
128
votes
9 answers

IOS7 : UIScrollView offset in UINavigationController

I'm currently migrating my app on ios 7 and I've been stuck for hours on the new navigationcontroller/bar management. Before, when we had a navigation controller, we had a snippet like this : UINavigationController *navController =…
streem
  • 9,044
  • 5
  • 30
  • 41
127
votes
8 answers

How to make completely transparent navigation bar in iOS 7

I want the UINavigationBar in my app to be completely transparent and flush with the viewcontroller directly under it. However, the only code I could find makes it translucent but not transparent. I know this can be done in iOS 7 because it is used…
cory ginsberg
  • 2,907
  • 6
  • 25
  • 37
116
votes
7 answers

How to add a button to UINavigationBar?

How to add a button to UINavigationBar programmatically?
RexOnRoids
  • 14,002
  • 33
  • 96
  • 136
101
votes
10 answers

UISegmentedControl below UINavigationbar in iOS 7

How do I make a UISegmentedControl as a part of an UINavigationBar below it? Is it connected to the UINavigationBar or is it a complete separate view just added as a subview to the UINavigationController's view controller. Looks like it is part of…
yoeriboven
  • 3,541
  • 3
  • 25
  • 40
100
votes
10 answers

How to prevent UINavigationBar from covering top of view in iOS 7?

After updating to Xcode 5, the navigation bars in all of my app's views have shifted down. Here are some screenshots, the first showing everything in the view as it's pulled down, and the second showing all of it untouched. The search bar should…
Sam D20
  • 2,535
  • 5
  • 25
  • 43
99
votes
8 answers

Swift programmatically navigate to another view controller/scene

I'm using following code to programmatically navigate to another ViewController. It works fine, but it some how hides the navigation bar. How do I fix this? (the navigation bar is created by embeding the ViewController in the navigation controller…
Victor
  • 1,603
  • 4
  • 17
  • 24