I'm attempting to set an attributed string on my back bar button item.
This is my first attempt at attributed strings.
Here is the code:
self.navigationItem.hidesBackButton = true
let barButtonBackStr = "< Back"
var attributedBarButtonBackStr = NSMutableAttributedString(string: barButtonBackStr as String)
attributedBarButtonBackStr.addAttribute(NSFontAttributeName,
value: UIFont(
name: "AmericanTypewriter-Bold",
size: 18.0)!,
range: NSRange(
location:0,
length:1))
let newBackButton = UIBarButtonItem(title: attributedBarButtonBackStr, style: UIBarButtonItemStyle.Plain, target: self, action: "barButtonBack:")
self.navigationItem.leftBarButtonItem = newBackButton
This results in the following error in Xcode.
Cannot invoke initializer for type 'UIBarButtonItem' with an argument list of type '(title: NSMutableAttributedString, style: UIBarButtonItemStyle, target: CombatOutcomeViewController, action: String)'
Anyone have an idea on how to do this? Thanks.