-2

I want to set title to my navigation bar. I'm using

[self.navigationItem setTitle:@"Some Title"]; 

But, the back button title is changed not the navigation bar title.

Larme
  • 24,190
  • 6
  • 51
  • 81
letsgotim
  • 99
  • 1
  • 9

5 Answers5

0

Try to set the title of your UINavigationController:

[self.navigationController setTitle:@"Title"];
AlexVogel
  • 10,601
  • 10
  • 61
  • 71
Luan D
  • 1,320
  • 1
  • 13
  • 26
0

Use this by this only navigation bar's title will change not back button's title

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

Did you implement back button like this way if not use this code

Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36
0
self.navigationController.navigationBar.topItem.title = @"myTitle";

or

in .h

IBOutlet UINavigationItem *navItem;

in .m

navItem.title = @"New Title";
Ramdhas
  • 1,765
  • 1
  • 18
  • 26
0
[self.navigationController.navigationItem setTitle:@"Title"];
Hassy
  • 5,068
  • 5
  • 38
  • 63
0

Adding this to your current view controller:

[self setTitle:@"Your Title"]

or set it up at previous view controller:

destinationViewControl.title = @"Your Title"
Michael Revlis
  • 1,463
  • 11
  • 14