Skip to content

Instantly share code, notes, and snippets.

@y-ogi
Last active August 29, 2015 14:07
Show Gist options
  • Save y-ogi/5cb62e241873ca676da2 to your computer and use it in GitHub Desktop.
Save y-ogi/5cb62e241873ca676da2 to your computer and use it in GitHub Desktop.
Using FontAwesome for RightBarButtonItem with Swift
let textAttributes = [
NSFontAttributeName: UIFont(name: "FontAwesome", size: 18),
NSForegroundColorAttributeName: UIColor.redColor()
]
let rightBarButtonItem = UIBarButtonItem(title: "Search", style: .Plain, target: nil, action: nil)
rightBarButtonItem.setTitleTextAttributes(textAttributes, forState: .Normal)
rightBarButtonItem.title = NSString.awesomeIcon(FaSearch)
self.navigationItem.rightBarButtonItem = rightBarButtonItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment