以下のようなコードの小さなチャンクを使用して、ナビゲーション バーのタイトル アプリ全体のテキスト属性を変更していますが、うまく機能します。
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor grayColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Cochin-BoldItalic" size:0.0], UITextAttributeFont,
nil]];
しかし、UIBarButtonItemテキストに対してもこれを簡単に実行できるようにしたいのですが、表示される同じまたは類似のメソッドを共有していないため、わかりません。
編集
テキストに変更を加えずに、このコードを試しました:
[[UIBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor grayColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Cochin-BoldItalic" size:12.0], UITextAttributeFont,
nil]
forState:UIControlStateNormal];