0

画面上で何かが実行されたときに更新される文字列を表示するためだけに機能するバーボタンアイテムがあります。テキストの色を白に設定しました。ただし、画面上では灰色で表示されます。テキストをどの色に変更しても、目的の色ではなく灰色がかった色になります。正しい色が得られないのはなぜですか? 私が行方不明になっているのはプロパティですか?

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];
4

1 に答える 1

0

ボタンが有効になっていないため、ボタンのテキストの色が灰色であることが判明しました。ボタンを有効に設定すると、テキストの色が白に変わりました。

[_timeButton setEnabled:YES];
于 2013-05-31T16:03:27.733 に答える