UIBarButtonItem为状态设置颜色

时间:2014-03-29 17:17:26

标签: ios uibarbuttonitem uicolor

尝试为UIBarButtonItem设置颜色。问题是我对setTitleTextAttributesUIControlStateDisabled两个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}},因此被禁用。

0 个答案:

没有答案