Questions tagged [uinavigationcontroller]

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

uinavigationcontroller
Filter by
Sorted by
Tagged with
403 votes
14 answers
216k views

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 ...
Lee Armstrong's user avatar
349 votes
18 answers
171k views

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 ...
ArtFeel's user avatar
  • 11.8k
330 votes
14 answers
319k views

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's user avatar
  • 8,158
327 votes
15 answers
191k views

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's user avatar
  • 16.8k
267 votes
32 answers
275k views

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 ...
StevenZ's user avatar
  • 7,053
252 votes
28 answers
244k views

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" ...
Onichan's user avatar
  • 4,496
249 votes
25 answers
236k views

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 ...
Jab's user avatar
  • 27.3k
192 votes
21 answers
221k views

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 ...
Artilheiro's user avatar
  • 4,005
181 votes
29 answers
170k views

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 ...
Parrots's user avatar
  • 26.7k
166 votes
19 answers
85k views

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" ...
G. Steve's user avatar
  • 2,859
165 votes
14 answers
90k views

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 ...
Zoran Simic's user avatar
  • 10.3k
163 votes
15 answers
243k views

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 ...
user avatar
163 votes
11 answers
222k views

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. ...
Shishir.bobby's user avatar
161 votes
17 answers
163k views

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 ...
meaning-matters's user avatar
155 votes
25 answers
158k views

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 ...
Rashmi Ranjan mallick's user avatar
150 votes
16 answers
101k views

UINavigationController "back button" custom text?

The "back button" of a UINavigationController by default shows the title of the last view in the stack. Is there a way to have custom text in the back button instead?
Ali Shafai's user avatar
  • 5,161
145 votes
10 answers
177k views

How to get root view controller?

I need an instance of root view controller. I tried those approaches: UIViewController *rootViewController = (UIViewController*)[[[UIApplication sharedApplication] keyWindow] rootViewController]; ...
Streetboy's user avatar
  • 4,371
142 votes
9 answers
148k views

How do I get the RootViewController from a pushed controller?

So, I push a view controller from RootViewController like: [self.navigationController pushViewController:anotherViewController animated:YES] ; BUT, FROM anotherViewController now, I want to access ...
bobobobo's user avatar
  • 66.1k
133 votes
15 answers
73k views

UIRefreshControl - beginRefreshing not working when UITableViewController is inside UINavigationController

I've setup a UIRefreshControl in my UITableViewController (which is inside a UINavigationController) and it works as expected (i.e. pull down fires the correct event). However, if I programmatically ...
wows's user avatar
  • 10.9k
130 votes
10 answers
66k views

Completion handler for UINavigationController "pushViewController:animated"?

I'm about creating an app using a UINavigationController to present the next view controllers. With iOS5 there´s a new method to presenting UIViewControllers: presentViewController:animated:...
geforce's user avatar
  • 2,623
127 votes
9 answers
50k views

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 : ...
streem's user avatar
  • 9,084
126 votes
36 answers
130k views

UINavigationBar Hide back Button Text

How can I hide the Back Button Text from an UINavigation Controller? I will only have the "<" and not "< Back"
Nils's user avatar
  • 1,487
122 votes
6 answers
89k views

UINavigationController without navigation bar?

I have a universal app, and on the iPad version I'm using UISplitViewController to create an interface similar to the Mail app. I was having trouble pushing new Detail views, so I decided to use a ...
DOOManiac's user avatar
  • 6,154
120 votes
10 answers
45k views

SplitView like Facebook app on iPhone

I want to create an iPhone app that uses a navigation scene similar to the one pictured in the link Please note I do not want this to only work for iPad, I want it to work for iPhone exactly as ...
Matt's user avatar
  • 2,930
120 votes
12 answers
45k views

Weird uitableview behaviour in iOS11. Cells scroll up with navigation push animation

I have recently migrated some code to new iOS 11 beta 5 SDK. I now get a very confusing behaviour from UITableView. The tableview itself is not that fancy. I have custom cells but in most part it is ...
iur's user avatar
  • 2,086
115 votes
16 answers
164k views

Removing viewcontrollers from navigation stack

I have a navigation stack, with say 5 UIViewControllers. I want to remove the 3rd and 4th viewcontrollers in the stack on the click of a button in the 5th viewcontroller. Is it possible to do this? If ...
Jean Paul's user avatar
  • 2,419
106 votes
12 answers
114k views

back button callback in navigationController in iOS

I have pushed a view onto the navigation controller and when I press the back button it goes to the previous view automatically. I want to do a few things when back button is pressed before popping ...
Namratha's user avatar
  • 16.7k
100 votes
17 answers
147k views

How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

I got the opposite issue from here. By default in iOS7, back swipe gesture of UINavigationController's stack could pop the presented ViewController. Now I just uniformed all the self.navigationItem....
Itachi's user avatar
  • 5,885
99 votes
19 answers
51k views

No Swipe Back when hiding Navigation Bar in UINavigationController

I love the swipe pack thats inherited from embedding your views in a UINavigationController. Unfortunately i cannot seem to find a way to hide the NavigationBar but still have the touch pan swipe ...
mihai's user avatar
  • 4,214
98 votes
18 answers
64k views

How do I pop two views at once from a navigation controller?

I want to pop to the third view on the navigation stack back to the first view. I know how to pop one view at once: [self.navigationController popViewControllerAnimated:YES]; But how do I do two at ...
Adam Waite's user avatar
  • 19.2k
95 votes
13 answers
28k views

Dark shadow on navigation bar during segue transition after upgrading to Xcode 5.1 and iOS 7.1

When I am navigating back & forth between parent and child controllers in a master - detail navigation controller, i see a dark shadow on the right side of navigation bar at top. It started after ...
Nihat's user avatar
  • 3,065
94 votes
12 answers
50k views

Set a custom subclass of UINavigationBar in UINavigationController programmatically

Does anyone know how can I use my custom subclass of UINavigationBar if I instantiate UINavigationController programmatically (without IB)? Drag a UINavigationController in IB show me an under ...
Duccio's user avatar
  • 949
93 votes
16 answers
309k views

How to Navigate from one View Controller to another using Swift

I'd like to navigate from one view controller to another. How can I convert the following Objective-C code into Swift? UIViewController *viewController = [[self storyboard] ...
sathish's user avatar
  • 1,180
93 votes
20 answers
275k views

Programmatically navigate to another view controller/scene

I got an error message during navigating from first view controller to second view controller. My coding is like this one let vc = LoginViewController(nibName: "LoginViewController", bundle: nil) ...
Nurdin's user avatar
  • 23.7k
92 votes
5 answers
113k views

Set rootViewController of UINavigationController by method other than initWithRootViewController

How Do I set the rootViewController of UINavigationController by a method other than initWithRootViewController? I want use initWithNavigationBarClass:toolbarClass: to deliver a custom toolbar for my ...
drc's user avatar
  • 1,915
89 votes
13 answers
148k views

iPhone: Setting Navigation Bar Title

Hey all. I'm still pretty new to iPhone development, and I'm having a bit of trouble figuring out how to change the title of my Navigation Bar. On another question on this site somebody recommended ...
Arthur Skirvin's user avatar
89 votes
5 answers
40k views

How to draw a transparent UIToolbar or UINavigationBar in iOS7

I would like an entirely transparent UIToolbar and/or UINavigationBar. I have tried the various incantations suggested for pre- and post-iOS 5 but none seem to work any more. How might this be ...
Ben Packard's user avatar
  • 26.3k
89 votes
21 answers
47k views

Popover with embedded navigation controller doesn't respect size on back nav

I have a UIPopoverController hosting a UINavigationController, which contains a small hierarchy of view controllers. I followed the docs and for each view controller, I set the view's popover-context ...
Ben Zotto's user avatar
  • 70.5k
87 votes
5 answers
74k views

Programmatically call navigation controller back button on iOS

In a UINavigationController-based iPhone app, in a method I would like to perform the programmatic equivalent of the back button being pressed and going back a view. i.e. automatically press the Jobs ...
oberbaum's user avatar
  • 2,451
86 votes
17 answers
64k views

How to add 2 buttons into the UINavigationbar on the right side without IB?

How can I add 2 buttons into the UINavigationBar without XIB? The 2 buttons should be aligned on the right side of the UINavigationBar. I know how I can add one button, but how about two?
Alexander's user avatar
  • 1,121
85 votes
16 answers
95k views

Disable swipe back gesture in Swift

Been looking around on here for a while but can't seem to find a working solution. I'm trying to disable the swipe to go back to previous view gesture, in Swift. I've tried a variety of solutions ...
Phil Hudson's user avatar
  • 3,871
84 votes
16 answers
81k views

How can I pop a view from a UINavigationController and replace it with another in one operation?

I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an editable item and then ...
Matt Brandt's user avatar
82 votes
14 answers
52k views

Changing back button in iOS 7 disables swipe to navigate back

I have an iOS 7 app where I am setting a custom back button like this: UIImage *backButtonImage = [UIImage imageNamed:@"back-button"]; UIButton *backButton = [UIButton buttonWithType:...
lehn0058's user avatar
  • 20.1k
81 votes
5 answers
123k views

presenting ViewController with NavigationViewController swift

I have system "NavigationViewController -> MyViewController", and I programmatically want to present MyViewController inside a third view controller. The problem is that I don't have navigation bar in ...
Yury Alexandrov's user avatar
79 votes
17 answers
98k views

How to identify previous view controller in navigation stack

I have 2 seperate navigationcontrollers, one with RootViewController A and the other with RootViewController B. I am able to push ViewController C onto either A or B's navigation stack. Question: ...
Zhen's user avatar
  • 12.4k
78 votes
15 answers
38k views

iOS 11 navigationItem.titleView Width Not Set

Seeing a behavior on iOS11 with a navigationItem.titleView where the width of the titleView is not the full width of the screen. I have a custom view that I set as the titleView. Previous to iOS11 ...
gngrwzrd's user avatar
  • 5,952
78 votes
8 answers
48k views

Set data in `prepareForSegue` with navigation controller

I am developing an iOS application in Swift. I want to send data from a view to an other one, using the prepareForSegue function. However, my target view is preceded by a navigation controller, so it ...
cedric petetin's user avatar
77 votes
13 answers
36k views

iOS 7 Translucent Modal View Controller

The App Store app on iOS 7 uses a frosted glass-type effect where it is possible to see the view behind. Is this using an API built into iOS 7 or is it custom code. I was hoping it would be the former ...
Ian's user avatar
  • 7,520
76 votes
10 answers
124k views

Trying to handle "back" navigation button action in iOS

I need to detect when the user taps the "back" button on the navigation bar, in order to perform some operations when that occurs. I'm trying to set manually an action to such button, this way: [self....
AppsDev's user avatar
  • 12.4k
74 votes
17 answers
123k views

Swift Custom NavBar Back Button Image and Text

I need to customise the look of a back button in a Swift project. Here's what I have: Here's what I want: I've tried creating my own UIBarButtonItem but I can't figure out how to get the image to ...
Conor's user avatar
  • 1,037

1
2 3 4 5
238