我在导航栏上有一个UIBarButtonItem。当我进入我的应用程序时,它开始白色(所需的颜色),然后突然切换为淡出的灰色。如果我与应用程序交互并稍后返回到同一视图控制器,则按钮将返回白色。可能导致这种情况的原因是什么?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleDone target:self action:@selector(handleBack:)];
[backButton setTitleTextAttributes:[NSDictionary dictionaryWithObject: [UIColor whiteColor]
forKey: UITextAttributeTextColor] forState:UIControlStateNormal];
//[backButton setTintColor: [UIColor whiteColor]];
self.navigationItem.leftBarButtonItem = backButton;
[self.navigationController.navigationBar setBarStyle: UIBarStyleBlack];
[self populateSpinners];
isCategoryPicker = true;
[self.view setTintAdjustmentMode:UIViewTintAdjustmentModeNormal];
}
我尝试在视图级别,工具栏级别和按钮级别设置色调颜色,似乎没有任何效果。任何帮助表示赞赏!