Navigationbar title and back button name are same?

add back button to navigation bar storyboard
swift uinavigationcontroller back button
add back button to navigation bar programmatically swift 4
back button not showing in navigation controller swift
custom back button swift
remove back button title swift 4
uinavigationcontroller custom back button
backbarbuttonitem

I created one title for navigationbar in my storyboard project ,but when I moved to next viewcontroller the back button shows the same name as my previous navigationbar(Main navigationbar) title.? Can i set separate title and back button names?

I tried following code but its not working ? why?

 self.navigationItem.title=@"Recent Books";
self.navigationItem.backBarButtonItem.title=@"Back";

According to UINavigationItem Class Reference

"When this navigation item is immediately below the top item in the stack, the navigation controller derives the back button for the navigation bar from this navigation item. [...] If you want to specify a custom image or title for the back button, you can assign a custom bar button item (with your custom title or image) to this property instead."

So try this in your first VC from where you are pushing other VC

self.navigationItem.title=@"Recent Books";
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
                                   initWithTitle:@"Back"
                                   style:UIBarButtonItemStylePlain
                                   target:nil
                                   action:nil];
self.navigationItem.backBarButtonItem=backButton;

ios, This will change to all view controllers in hierarchy, so if you press back button, then, previous view controller title will also get affected. So, that case needs to be​  "When this navigation item is immediately below the top item in the stack, the navigation controller derives the back button for the navigation bar from this navigation item. If you want to specify a custom image or title for the back button, you can assign a custom bar button item (with your custom title or image) to this property instead."

Let's say you are pushing your viewcontroller A -> B

In viewcontroller A try adding this code in viewDidLoad method

UIBarButtonItem *btn_Back = [[UIBarButtonItem alloc] initWithTitle:@"Back"
 style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem=btn_Back;

So you will see your "Back" button in viewcontroller B

Using The Navigation Bar Title and Back Button in Swift 3.0 – Make , Add the four constraints. Now Control-drag from the Pizza button to the Pasta button. Select Equal Widths in the menu that appears. 2016-06-  As you work out the design of your app you may want a more complicated Navigation Bar that has a company logo, title and a call to action with a button. While there is a lot more going on with the Navigation Bar the principles are still the same. Just add XAML for what you want and wire it up. But WAIT! This one requires a few more steps since.

The following should solve your problem

-(void)viewDidAppear:(BOOL)animated
{
    self.navigationController.navigationBar.backItem.title = @"back";
}

You can also use this Objective-C syntax

[[self.navigationController.navigationBar backItem] setTitle:@"back"];

Swift Swift: Using The Navigation Bar Title and Back button. – Make , Swift Swift: Using The Navigation Bar Title and Back button. Posted on March the Pasta button. Select Equal Widths in the menu that appears. Programming the Back Button You’ll notice once you have a title, the navigation Back button disappears, to be replaced by the previous view’s title. The Back button reads the controller underneath the current controller for its title. You cannot set the back button title directly.

Just do it in this way , one of the easiest way I did find till now :

Create a custom back button and add it into the Navigation Bar left button item property :

- (void)viewDidLoad
{
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *backBtnImage = [UIImage imageNamed:@"Backnavigation.png"]  ; // Here set the back button image
[backBtn setBackgroundImage:backBtnImage forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(handleBack:) forControlEvents:UIControlEventTouchUpInside];
backBtn.frame = CGRectMake(0, 0, 24, 24);
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backBtn] ;
self.navigationItem.leftBarButtonItem = backButton;
}


//Handle the Back Button Event
- (void) handleBack:(id)sender
{
    // do your custom handler code here
    [self.navigationController popViewControllerAnimated:YES];
}

Also, doing this way, you don't need to change the title of NavigationBar every-time.

Here is the Back Button for your reference :

backBarButtonItem, If the title of your back button is too long to fit in the available space on the navigation bar, the navigation bar may substitute the string “Back” in place of the​  The Universal Windows Platform (UWP) provides a consistent back navigation system for traversing the user's navigation history within an app and, depending on the device, from app to app. To implement backwards navigation in your app, place a back button at the top left corner of your app's UI. If your app uses the NavigationView control, then

You can use the below code in the viewWillAppear(animated:Bool) method of the view controller in which you want to set the backButton title of you choice : self.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: "Back Title", style: .plain, target: nil, action: nil)

UINavigationController, Tapping the back button in the navigation bar at the top of the interface removes the navigation bar displays a label containing the view controller's default title. controllers to the navigation stack in the same order that they were preserved. By the end of this video you will have the knowledge to customize the back button (backBarButtonItem and backIndicatorImage) on your UINavigationController (or as some people call it the "Nav Bar

How to customize a view controller's back button on a navigation bar , How to customize a view controller's back button on a navigation bar: backBarButtonItem comes in: set this to an instance of UIBarButtonItem to have UIKit create a back button title of your choosing. Similar solutions… Hide the Xamarin Forms navigation bar and implementing a custom one using any forms layout. The problem with this approach might be handling the glitches caused by navigation transitions especially on Android when using the forms navigation bar on some pages and in other’s not. Implement customization on each platform by using custom renderers.

Navigation Bar Customisation. Part 1, Customisation of a navigation bar is one of the first tasks a junior iOS-developer takes up. Background; Title; Bar buttons; Back button; Shadow/separator we can set a custom view instead of a default label to be our title:  Navigation Bars. A navigation bar appears at the top of an app screen, below the status bar, and enables navigation through a series of hierarchical screens. When a new screen is displayed, a back button, often labeled with the title of the previous screen, appears on the left side of the bar.

Implementing a Custom Back Button in Swift - TJ Carney, During this process, I noticed that the back button on my navigation bar didn't look great So first, I declared the constant and set it equal to my image. would normally appear like “back” or the name of the previous view controller. So in order to set the title for the back button, you need to do so in the 

Comments
  • Please look at my answer stackoverflow.com/questions/9871578/…
  • That answer not working for me
  • I have two BarButton customized on my first view, on the left to "Information" and the right to "Settings". And yet, I had to set a name for BackButton in the first view to. In my component tree now are three BarButton, but when I run the app everything worked normally. Simply makes no sense.