I want to change the identifier of an UIBarButtonItem with codes from \"Play\" to \"Pause\". How can I do that?
Thanks
This code is tested and working with Swift 2
@IBOutlet weak var navigationBar: UINavigationBar!
//playToPause()
@IBAction func playButton(sender: UIBarButtonItem) {
let newBarButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Pause, target: self, action: "pauseButton:")
navigationBar.topItem?.rightBarButtonItem = newBarButton
}
// pauseToPlay()
@IBAction func pauseButton(sender: UIBarButtonItem){
let pauseBtnItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Play, target: self, action: "playButton:")
navigationBar.topItem!.rightBarButtonItem = pauseBtnItem
}