This may be the same issue as Pixate Freestyle: clear styleClass property does not reset style. But I can't tell.
I have styled a UINavigationBar and the title and left and right buttons. My view is a table view. When I select a cell I restyle the navbar when I push a new view on the stack.
When I pop the view, I want the old style to take effect. However the buttons does not get restyled.
CSS:
navigation-bar {
opacity: 1;
color: black;
background-color: white;
}
navigation-bar title {
color: black;
}
navigation-bar button-appearance {
color: black;
}
navigation-bar.he {
background-color: darkgreen;
color: white;
}
navigation-bar.he button-appearance {
color: white;
}
navigation-bar.he title {
color: white;
}
Pushing a new view controller works:
-(void)viewDidLoad {
self.navigationController.navigationBar.styleClass = [self.dict objectForKey:CLASS]; // Imagine this is he
}
Popping the view controller and going back to the parent viewController:
-(void)viewWillAppear:(BOOL)animated
{
// This updates the bar and title but not the buttons
self.navigationController.navigationBar.styleClass = @"";
[self.navigationController.navigationBar updateStyles];
[self.navigationController.navigationItem updateStyles];
[self.navigationItem.rightBarButtonItem updateStyles];
/* Hack ...
if(self.navigationItem.rightBarButtonItem!=nil)
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor];
if(self.navigationItem.leftBarButtonItem!=nil)
self.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
*/
}