0

Right now I have a TableViewController, let's say with a title "Main Menu" and when you click the first cell it leads to a detail view controller with a back button. Instead of just having "back, it has the title of the TableViewController which is "Main Menu"

How do I set it so that it just says "Back"?

Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
user1677210
  • 169
  • 1
  • 1
  • 13
  • http://stackoverflow.com/questions/1449339/how-do-i-change-the-title-of-the-back-button-on-a-navigation-bar – danh Dec 21 '12 at 16:24

2 Answers2

4

This can actually be done very easily using the setTitle attribute of the navigation items backBarButtonItem. The only thing about this that isn't really very intuitive is that you have to set these attributes on the parent view controller (the one you're pushing from). This can be done either programmatically or in interface builder.

[[[self navigationItem] backBarButtonItem] setTitle:@"Back"];

enter image description here

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
0

You could set the title of the previous view controller to nil, and the navigationItem.title to the text you want to display in the navigation bar. That way, the next view controller will have "Back" written on it`s back button.

Levi
  • 7,313
  • 2
  • 32
  • 44