Search code examples
iosxcodeuinavigationitem

iOS / Xcode - Navigation Item BackBarButtonItem title shows the one of the previous controller


i have 2 View Controllers connected by a segue within a Navigation Controller and I edited the back items titles in Interface Builder.

My problem is, that the BackBarButtonItem of the second controller shows the title of the first (and presenting) controller's BackBarButtonItem, no matter what I set for Back on the second controller's NavigationItem.

The only thing I've done is setting the leftBarButtonItem for the first Controller:

self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Close", style: UIBarButtonItemStyle.Plain, target: self, action: "backTapped:")

Now all NavigationItems of presented Controllers show "Close". Does anyone have an idea, what's going on?

Thanks in advance


Solution

  • You have to configure desired back button item title on the view controller to which back will be performed, e.g. on previous one.