0

I have a bar button item that only functions to display a string that is updated when something is performed on screen. I have set the text color to white. But, it is displayed on screen with a gray color. Whatever color I change the text to I still get a grayish color instead of the desired color. Why am I not getting the the right color? Is it a property that I'm missing?

UIColor *buttonColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0];
_timeButton.title = [NSString stringWithFormat:@"Updated at:  %@",dateString];
[_timeButton setStyle:UIBarButtonItemStylePlain];
_timeButton.tintColor = [UIColor clearColor];
[_timeButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                     [UIFont boldSystemFontOfSize:15], UITextAttributeFont,
                                     buttonColor ,UITextAttributeTextColor,
                                      nil]
                                        forState:UIControlStateNormal];
DaveLass
  • 625
  • 1
  • 8
  • 17
  • Take a look at this : http://stackoverflow.com/questions/664930/uibarbuttonitem-with-color – Anil May 30 '13 at 05:28
  • Thanks for the link. However, nothing in that thread had anything to do with setting text on a plain bar button item. And my issue is that my text is not [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]; but closer to [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:.5]; I want the latter. – DaveLass May 30 '13 at 13:38

1 Answers1

0

Turns out that my text color of my button was gray because the button was not enabled. Setting the button to enabled changed the color of the text to white.

[_timeButton setEnabled:YES];
DaveLass
  • 625
  • 1
  • 8
  • 17