ios - backBarbuttonitem does nothing? -


i have set navigation programmatically

in view controller set backbutton , change title per documentation. clicking on button in child controller nothing.

what did miss?

> in viewcontroller      let backitem = uibarbuttonitem()     backitem.title = ""     navigationitem.backbarbuttonitem = backitem     self.navigationcontroller?.pushviewcontroller(secondviewcontroller, animated: true) 

you have add target , action button,

let backitem = uibarbuttonitem() backitem.title = "" backitem.target = self backitem.action = #selector(back) navigationitem.backbarbuttonitem = backitem self.navigationcontroller?.pushviewcontroller(secondviewcontroller, animated: true) 

and implement back() function.

func back() {     // if view controller presented navigation controller     self.navigationcontroller?.popviewcontrolleranimated(true)      // if view controller presented modally     self.presentingviewcontroller?.dismiss(animated: true, completion: nil) } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -