In iOS6, I used this code to make my UIBarButtonItem:
UIBarButtonItem* validate = [[UIBarButtonItem alloc]initWithTitle:@\"MyTitle\" style:UIBarButtonItemSty
I couldn't get @Chris's method to work (iOS 8 like @Adama says).
My use case is that I want to set all UIToolbar
& UINavigationBar
buttons to a default colour. So using the UIAppearance
API:
UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.redColor()], forState: .Normal)