Questions tagged [uinavigationcontroller]

The UINavigationController class implements a specialized iOS view controller that manages the navigation of hierarchical content.

This class is not intended for subclassing. Instead, you use instances of it as-is in situations where you want your application’s user interface to reflect the hierarchical nature of your content. This navigation interface makes it possible to present your data efficiently and also makes it easier for the user to navigate that content.

The screens presented by a navigation interface typically mimic the hierarchical organization of your data. At each level of the hierarchy, you provide an appropriate screen (managed by a custom view controller) to display the content at that level.

Sample of use

References:

UINavigationController Class Reference

11391 questions
402
votes
14 answers

iPhone hide Navigation Bar only on first page

I have the code below that hides and shows the navigational bar. It is hidden when the first view loads and then hidden when the "children" get called. Trouble is that I cannot find the event/action to trigger it to hide again when they get back…
Lee Armstrong
  • 11,420
  • 15
  • 74
  • 122
346
votes
18 answers

How to disable back swipe gesture in UINavigationController on iOS 7

In iOS 7 Apple added a new default navigation behavior. You can swipe from the left edge of the screen to go back on the navigation stack. But in my app, this behavior conflicts with my custom left menu. So, is it possible to disable this new…
ArtFeel
  • 11,701
  • 4
  • 29
  • 41
328
votes
14 answers

How to hide a navigation bar from first ViewController in Swift?

How can I hide a navigation bar from first ViewController or a particular ViewController in swift? I used the following code in viewDidLoad(): override func viewDidLoad() { super.viewDidLoad() …
Vettiyanakan
  • 7,957
  • 6
  • 37
  • 55
327
votes
15 answers

How to hide 'Back' button on navigation bar on iPhone?

I added a navigation control to switch between views in my app. But some of the views shouldn't have 'Back' (the previous title) button. Any ideas about how to hide the back button?
Chilly Zhong
  • 16,763
  • 23
  • 77
  • 103
264
votes
32 answers

Execute action when back bar button of UINavigationController is pressed

I need to execute an action (emptying an array), when the back button of a UINavigationController is pressed, while the button still causes the previous ViewController on the stack to appear. How could I accomplish this using swift?
StevenZ
  • 6,983
  • 5
  • 16
  • 18
251
votes
28 answers

How to set back button text in iOS navigation controller?

How do you remove the back button text. Current back button: < Back Desired back button: < AnythingElse None of these have worked: self.navigationItem.backBarButtonItem?.title = "Back" self.backItem?.title =…
Onichan
  • 4,476
  • 6
  • 31
  • 60
247
votes
25 answers

How to change the Push and Pop animations in a navigation based app

I have a navigation based application and I want to change the animation of the push and pop animations. How would I do that? Edit 2018 There have been many answers to this question and it's been quite awhile now, I have re-chosen the answer to what…
Jab
  • 26,853
  • 21
  • 75
  • 114
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
181
votes
29 answers

Setting action for back button in navigation controller

I'm trying to overwrite the default action of the back button in a navigation controller. I've provided a target an action on the custom button. The odd thing is when assigning it though the backbutton attribute it doesn't pay attention to them and…
Parrots
  • 26,658
  • 14
  • 59
  • 78
164
votes
14 answers

How to hide the "back" button in UINavigationController?

Do you know how to hide the 'back' button in a UINavigationController? Also, how to show it back, but I guess that's very similar to hiding it... Just like the mail application does on the iPhone when you hit 'Edit' while viewing emails.
Zoran Simic
  • 10,293
  • 6
  • 33
  • 35
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
162
votes
19 answers

iOS 15 Navigation Bar Transparent

My iOS app uses the storyboard for the UI and uses a custom tint for the background color of the navigation bar. I have tested my app on the Xcode 13 beta 5 and the navigation bar is "white" and the text on the navigation bar is not visible. In the…
G. Steve
  • 2,739
  • 2
  • 11
  • 17
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
158
votes
17 answers

How to check if a view controller is presented modally or pushed on a navigation stack?

How can I, in my view controller code, differentiate between: presented modally pushed on navigation stack Both presentingViewController and isMovingToParentViewController are YES in both cases, so are not very helpful. What complicates things is…
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
155
votes
25 answers

How to force view controller orientation in iOS 8?

Before iOS 8, we used below code in conjunction with supportedInterfaceOrientations and shouldAutoRotate delegate methods to force app orientation to any particular orientation. I used below code snippet to programmatically rotate the app to desired…
1
2 3
99 100