这可能是与Pixate Freestyle: clear styleClass property does not reset style相同的问题。但我看不出来。
我已经设置了UINavigationBar、标题和左、右按钮的样式。我的视图是表格视图。当我选择一个单元格时,当我在堆栈上推送一个新视图时,我会重新设置导航栏的样式。
当我弹出视图时,我希望旧样式生效。但是,按钮不会重新设置样式。
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;
}推送一个新的视图控制器工作:
-(void)viewDidLoad {
self.navigationController.navigationBar.styleClass = [self.dict objectForKey:CLASS]; // Imagine this is he
}弹出视图控制器并返回父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];
*/
}发布于 2014-07-05 16:51:25
我在这里找到了答案:Styling UINavigationBar Part 2
我正在使用Freestyle网站上的文档,并尝试使用按钮外观。
正确的样式现在是右栏按钮和左栏按钮。
navigation-bar {
opacity: 1;
color: black;
background-color: white;
}
navigation-bar title {
color: black;
}
navigation-bar right-bar-button, navigation-bar left-bar-button {
color: black;
}
navigation-bar.he {
background-color: darkgreen;
color: black;
}
navigation-bar.he title {
color: black;
}
navigation-bar.he right-bar-button, navigation-bar.he left-bar-button {
color: black;https://stackoverflow.com/questions/24582391
复制相似问题