【发布时间】:2014-03-06 02:53:46
【问题描述】:
我有一个 UIBarButtonItem 的图像,但我不想显示突出显示的状态。现在,当按下按钮时,我的图像变灰了。我尝试为突出显示的状态设置相同的图像,但没有做任何事情。
谢谢
【问题讨论】:
标签: ios uibarbuttonitem
我有一个 UIBarButtonItem 的图像,但我不想显示突出显示的状态。现在,当按下按钮时,我的图像变灰了。我尝试为突出显示的状态设置相同的图像,但没有做任何事情。
谢谢
【问题讨论】:
标签: ios uibarbuttonitem
我的朋友试试这个:
设置按钮
adjustImageWhenHighlighted = NO;
应该可以解决问题。
希望对您有所帮助。干杯
更新:
// Initialize the UIButton
UIButton *customButton= [UIButton buttonWithType:UIButtonTypeCustom];
//normal_button.png and selected_button.png need to be created by you
[customButton setBackgroundImage: [UIImage imageNamed:@"normal_button.png"] forState:UIControlStateNormal];
[customButton setBackgroundImage: [UIImage imageNamed:@"normal_button.png"] forState:UIControlStateSelected];
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView: customButton];
另一种方法。
【讨论】: