I saw looked at several threads and this is the only answer that actually does what I'm looking for. The only problem I have is that it moves my toolbar item to the far left, and I have it centered. If you have your button centered with a flexible space bar, or if it is not the first button, just change the index like this:
toolbar.items![1] = playPauseButton //apply for second toolbar item
If you're also having trouble accessing the navigation bar it is probably best to just set some tag to it (I like to use negative tags for specific Views* to make sure 2 views* don't get the same tag).
Then you could fx do like this:
let navigationBar = (self.view.viewWithTag(-1) as UINavigationBar)
navigationBar.topItem?.leftBarButtonItem?.title = "AnyText"
I use this code to switch Edit mode
For a toolbar item, here is the sample code.
I saw looked at several threads and this is the only answer that actually does what I'm looking for. The only problem I have is that it moves my toolbar item to the far left, and I have it centered. If you have your button centered with a flexible space bar, or if it is not the first button, just change the index like this:
toolbar.items![1] = playPauseButton //apply for second toolbar item
1) init a new button
2) Just change the text:
If you're also having trouble accessing the navigation bar it is probably best to just set some tag to it (I like to use negative tags for specific Views* to make sure 2 views* don't get the same tag). Then you could fx do like this:
This code is tested and working with Swift 2