I want to change the color to red.
I found a simpler way to just change the color of title: iOS7:
UIBarButtonItem *button =
[[UIBarButtonItem alloc] initWithTitle:@"Title"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
[button setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor], NSForegroundColorAttributeName,nil]
forState:UIControlStateNormal];
and prior iOS7:
UIBarButtonItem *button =
[[UIBarButtonItem alloc] initWithTitle:@"Title"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
[button setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor], UITextAttributeTextColor,nil]
forState:UIControlStateNormal];