尝试为UIBarButtonItem
设置颜色。问题是我对setTitleTextAttributes
和UIControlStateDisabled
两个UIControlStateNormal
NSDictionaries
NSDictionary *enabled = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor purpleColor],NSForegroundColorAttributeName,
[UIFont fontWithName:@"Playball" size:20], NSFontAttributeName,
nil];
NSDictionary *disabled = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor yellowColor],NSForegroundColorAttributeName,
[UIFont fontWithName:@"Playball" size:20], NSFontAttributeName,
nil];
[[self toolBarItem] setTitleTextAttributes:disabled forState:UIControlStateDisabled];
[[self toolBarItem] setTitleTextAttributes:enabled forState:UIControlStateNormal];
[[self toolBarItem] setEnabled:NO];
不能toolBarItem
。
这就是我要做的事情:
setEnable:NO
出于某种原因,{{1}}是紫色的,因为它应该是黄色的,因为{{1}},因此被禁用。