Tom Kuschka
Tom Kuschka

Reputation: 483

change the title of a backButtonItem in swift

I´m just a beginner in Swift and i don´t get it. Why doesn't change the title of my backBarButtonItem after the push segue?

I tried it with this code in the viewDidLoad:

navigationItem.backBarButtonItem?.title = "Back"

Can somebody help me?

Upvotes: 0

Views: 401

Answers (1)

codester
codester

Reputation: 37189

Use ! not ?. ! is used for getting value from optional or unwrapping the optional

 self.navigationItem.backBarButtonItem!.title = "Back"

Upvotes: 1

Related Questions