プログラムでタブバーアイテムのテキストの色を変更しようとしています。使ってます
[[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]];
これはiOS5以降で動作するはずです。しかし、私のアプリはコンソールでエラーでクラッシュします:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearance setTitleTextAttributes:]: unrecognized selector sent to instance 0x79f5790'
*** First throw call stack:
わからない、なぜ私はクラッシュするのか。また、タブバーアイテムのフォントの色を変更する他の方法がある場合は、提案してください。
ありがとう