【发布时间】:2014-03-06 08:28:09
【问题描述】:
在我的 iPad 应用程序中,我有一个应用程序设置视图。其中一个选项允许用户切换界面配色方案。设置视图由 segue 加载到一个单独的视图控制器,而不是我的“主”应用程序的窗口。
当他们选择一种新颜色时,我切换 colorSchemeColor 变量并执行以下操作:
// set the colors and refresh the view
[[UINavigationBar appearance] setBarTintColor:colorSchemeColor];
[[UIToolbar appearance] setBarTintColor:colorSchemeColor];
[[UITabBar appearance] setBarTintColor:colorSchemeColor];
但是,在我退出设置视图之前,所有条形都不会改变颜色! (当设置窗口消失时,“主”应用程序的颜色会正确更改!)
然后我尝试在刷新设置视图之后立即放置此代码:
[self.view setNeedsDisplay];
[self.view setNeedsLayout];
这没有帮助。所以我也添加了这个:
[self.navigationController.view setNeedsDisplay];
[self.navigationController.view setNeedsLayout];
这也没有用。
如何在挑选新颜色时将我的设置视图“重绘”自身恢复,因此更改即时显而易见?
非常感谢!
【问题讨论】:
标签: uinavigationbar uitabbar uitoolbar appearance