swift - iOS Navigation Back Button -


i want have button on second view controller have. when loads now, show button want change title else. implemented viewwillappear method invoke showing navigation bar. following didn't work:

 override func viewwillappear(animated: bool) {         super.viewwillappear(animated);         self.navigationcontroller?.navigationbar.hidden = false         self.navigationcontroller?.navigationbar.backitem?.title = "something else"      } 

please me change title. should in willappear or viewdidload?

add right before push or popviewcontroller statement in first view:

let backbutton = uibarbuttonitem(title: "something else",style: uibarbuttonitemstyle.plain ,target: nil,action: nil) self.navigationcontroller!.navigationbar.topitem!.backbarbuttonitem = backbutton 

or can in second view way:

override func viewwillappear(animated: bool) {     super.viewwillappear(animated);      let backbutton = uibarbuttonitem(title: "something else",style: uibarbuttonitemstyle.plain ,target: nil,action: nil)     self.navigationcontroller!.navigationbar.topitem!.backbarbuttonitem = backbutton } 

Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -