(Xcode6, iOS8, iPhone, Swift)
I would like to add a "Continue" button on the right of the navigation bar.
How can this be accomplished? I've been trying with some of the methods available on UIBarButtonItem, but can't get it working.
My best effort to date has been:
var b = UIBarButtonItem(title: "Continue", style: UIBarButtonItemStyle, target: self, action: nil)
self.navigationItem.rightBarButtonItem = b
But I'm getting an error on the first line. It doesn't like the "style" parameter. I've also tried
var b = UIBarButtonItem(title: "Continue", style: UIBarButtonItemStylePlain, target: self, action: nil)
But no luck. Still stuck on the style parameter. Any ideas? tyvm Keith :D
EDIT: For posterity, the following line also includes an action
setting:
var b = UIBarButtonItem(title: "Continue", style: .Plain, target: self, action:"sayHello")
Reference: How to set the action for a UIBarButtonItem in Swift