Iphone 禁用栏按钮文本颜色更改为白色?
下面给出的是我的导航栏的图像,其中右栏按钮现在处于禁用状态。但当我禁用它时,它的文本将变为白色。我不要白色。任何解决办法 启用“编辑”按钮时的第一个图像。 禁用“编辑”按钮时的其他。 在这种情况下,我们可以禁用按钮而不更改其文本颜色吗。非常感谢 这是用于自定义工具栏按钮Iphone 禁用栏按钮文本颜色更改为白色?,iphone,navigationbar,rightbarbuttonitem,navigationitem,Iphone,Navigationbar,Rightbarbuttonitem,Navigationitem,下面给出的是我的导航栏的图像,其中右栏按钮现在处于禁用状态。但当我禁用它时,它的文本将变为白色。我不要白色。任何解决办法 启用“编辑”按钮时的第一个图像。 禁用“编辑”按钮时的其他。 在这种情况下,我们可以禁用按钮而不更改其文本颜色吗。非常感谢 这是用于自定义工具栏按钮 [[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:253.0/255.0 green:220.0/255.0 blue:135.0/255.0 a
[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:253.0/255.0 green:220.0/255.0 blue:135.0/255.0 alpha:1.0]];
[[UIBarButtonItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor], UITextAttributeTextColor,
[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0], UITextAttributeTextShadowColor,
[UIFont fontWithName:@"MyriadPro-Cond_0" size:16.0], UITextAttributeFont, nil]
forState:UIControlStateNormal];
UIBarButtonItem *rightBarBtnEdit=[[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:@selector(methodEdit:)];
[rightBarBtnEdit setTag:701];
[self.navigationItem setRightBarButtonItem:rightBarBtnEdit];
这是酒吧按钮
[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:253.0/255.0 green:220.0/255.0 blue:135.0/255.0 alpha:1.0]];
[[UIBarButtonItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor], UITextAttributeTextColor,
[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0], UITextAttributeTextShadowColor,
[UIFont fontWithName:@"MyriadPro-Cond_0" size:16.0], UITextAttributeFont, nil]
forState:UIControlStateNormal];
UIBarButtonItem *rightBarBtnEdit=[[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:@selector(methodEdit:)];
[rightBarBtnEdit setTag:701];
[self.navigationItem setRightBarButtonItem:rightBarBtnEdit];
这是禁用
self.navigationItem.rightBarButtonItem.enabled = NO;
对于要自定义的每个状态,应多次调用setTitleTextAttributes:forState:。在您调用它一次的时候,对于
UIControlStateNormal
,对于其他状态,值将处于其默认值
也可以使用
UIControlStateDisabled
调用它,并使用您需要的任何属性 给出你的编辑按钮代码…用编辑按钮的初始配置发布编辑按钮代码我也把代码放进去了