UItabbar settitlecolor,iPhone

Posted by FirstTimer on Stack Overflow See other posts from Stack Overflow or by FirstTimer
Published on 2012-07-09T09:08:26Z Indexed on 2012/07/09 9:15 UTC
Read the original article Hit count: 162

Filed under:
|

I am trying to change the color of the text of tabbar item,programmatically. I am using

[[UITabBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       [UIFont fontWithName:@"AmericanTypewriter" size:20.0f], UITextAttributeFont,
                                                       [UIColor blackColor], UITextAttributeTextColor,
                                                       [UIColor grayColor], UITextAttributeTextShadowColor,
                                                       [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
                                                       nil]];

Which should works on iOS5 and above. But my apps gets crashed with error at console :

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearance setTitleTextAttributes:]: unrecognized selector sent to instance 0x79f5790'
*** First throw call stack:

Not sure, why i am getting a crash. Also please suggest, if there is any other way to change the font color of the tabbar items.

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iPad