BWSnippet

Swift Right Bar Button Item

Swift Right Bar Button Item

Setting the right bar button item on nav controller with swift.

 

let doneBtn = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done , target: self, action: #selector(controller.donePressed) )

navigationItem.rightBarButtonItem = doneBtn

 

Or Left Button..

 

let doneBtn = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done , target: self, action: #selector(controller.donePressed) )

navigationItem.leftBarButtonItem = doneBtn

 

Tags

Swift Right Bar Button Item