5

How can I remove a title from back button in navigation bar, but I want to keep the arrow.

Stevik
  • 1,072
  • 1
  • 15
  • 37

2 Answers2

8

Set the title text to an empty string.

navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil)

Edit: As per comments below this will only work if you set the back button before you segue to the view controller with the button in it.

yesthisisjoe
  • 1,877
  • 2
  • 15
  • 32
3

If you do not need the title, do this in viewDidLoad of your previous ViewController

title = ""

If you need the title for first ViewController, toggle setTitle between viewWillAppear and viewWillDisAppear of previous viewController will do.

Warif Akhand Rishi
  • 23,094
  • 6
  • 79
  • 103