So I have 3 View controllers : V1, V2 and V3. When I press a button on V1 it shoots me over to V3. I would like to keep the "Back Arrow" but change the text there. I have tried many things but the word back either reapers when the view is shown or my code does not work.
Any Suggestions?
I already used this code
self.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: "YO", style: .Plain, target: nil, action: nil)
let backbutton = UIButton(type: .Custom)
backbutton.setImage(UIImage(named: "BackButton.png"), forState: .Normal) // Image can be downloaded from here below link
backbutton.setTitle("Back", forState: .Normal)
backbutton.setTitleColor(backbutton.tintColor, forState: .Normal) // You can change the TitleColor
backbutton.addTarget(self, action: "backAction", forControlEvents: .TouchUpInside)
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backbutton)
func backAction() -> Void {
self.navigationController?.popViewControllerAnimated(true)
}
I tried creating my Button with this code I found on Stack But the button disappeared and the back button appeared in its place again.
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil)try this with inviewDidLoadand already there are lot of question related to this.