Questions tagged [uinavigationitem]

on iOS, the UINavigationItem class encapsulates information about a navigation item pushed on a UINavigationBar object’s stack

UINavigationItem is a part of the UIKit framework and is available from iOS 2 and later. The UINavigationItem class encapsulates information about a navigation item pushed on a UINavigationBar object’s stack

UINavigationItem Class Reference

1143 questions
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
227
votes
37 answers

How do I change the title of the "back" button on a Navigation Bar

Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the text shown on the button to something else. I tried…
Dale
  • 3,527
  • 6
  • 24
  • 22
199
votes
39 answers

Removing the title text of an iOS UIBarButtonItem

What I wanted to do is to remove the text from the 'Back' button of a UIBarButtonItem, leaving only the blue chevron on the navigation bar. Keep in mind that I'm developing for iOS 7. I've tried several methods, including, but not limited to: This…
Pan Ziyue
  • 2,287
  • 2
  • 16
  • 17
106
votes
12 answers

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 the view off the stack. Which is the back button…
Namratha
  • 16,630
  • 27
  • 90
  • 125
98
votes
17 answers

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.leftBarButtonItem style for all the…
90
votes
20 answers

How to change text on a back button

By default the back button uses as a text on it a title of a viewcontroller. Can I change text on the back button without changing a title of a view controller? I need this because I have a view controller which title is too long to display and in…
Ilya Suzdalnitski
  • 52,598
  • 51
  • 134
  • 168
89
votes
13 answers

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 using : viewController.title = @"title…
87
votes
6 answers

Show search bar in navigation bar without scrolling on iOS 11

I’m attaching a UISearchController to the navigationItem.searchController property of a UITableViewController on iOS 11. This works fine: I can use the nice iOS 11-style search bar. However, I’d like to make the search bar visible on launch. By…
Jonathan
  • 6,572
  • 1
  • 30
  • 46
75
votes
15 answers

UIBarButtonItem with custom view not properly aligned on iOS 7 when used as left or right navigation bar items

The following code works up through iOS 6: UIButton *myButton = nil; myButton = [UIButton buttonWithType:UIButtonTypeCustom]; myButton.bounds = CGRectMake(0,0,44,30); // setup myButton's images, etc. UIBarButtonItem *item = nil; item =…
61
votes
11 answers

UINavigationBar multi-line title

Is there a straightforward way of overriding the titleView of the current navigation bar item in a navigation bar within a navigation controller? I've tried creating a new UIView and replacing the titleView property of topView with my own UIVIew…
60
votes
18 answers

How to change the UINavigationController back button name?

I have a UIViewController and I'm navigating from my first view controller to second view controller and I want to change the name of the button shown on the navigationcontroller for going back .... SecondViewController *secondController =…
Bulla
  • 924
  • 1
  • 7
  • 15
52
votes
11 answers

Add subtitle under the title in navigation bar controller in Xcode

So I'm wanting to add a "subtitle" under the title in the navigation bar in navigation controller. Mostly everything I look up so far wants me to use CGRect. I don't know a whole lot what that is and it sounds like its wanting me to create an entire…
34
votes
8 answers

Customize navigation bar with title view

I am trying to add a custom view in the center of a navigation bar and I am using the following code to test it: UIView * testView = [[UIView alloc] init]; [testView setBackgroundColor:[UIColor blackColor]]; testView.frame = CGRectMake(0, 0, 100,…
Julian Osorio
  • 1,116
  • 1
  • 12
  • 30
33
votes
9 answers

navigation bar right bar button items spacing

I have created a with left bar button item added from storyboard, titleView and three right bar button items from code. Here is the code: override func viewDidLoad() { super.viewDidLoad() var screenWidth =…
mkz
  • 2,302
  • 2
  • 30
  • 43
33
votes
8 answers

How to properly position the back button in iOS7

I used this code to use a custom image as the back button in the whole app. [[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"back"]]; [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage…
Bernat
  • 1,537
  • 3
  • 18
  • 40
1
2 3
76 77