我需要为 UINavigationBar 按钮设置自定义颜色。
我正在做以下事情(RGB func 是一个定义):
- (void)viewWillAppear:(BOOL)animated
{
for (UIView *view in self.navigationController.navigationBar.subviews)
if ([[[view class] description] isEqualToString:@"UINavigationButton"])
[(UINavigationButton *)view setTintColor:RGB(22.0,38.0,111.0)];
}
应用程序加载时一切看起来都很好。离开视图并返回后,颜色恢复为默认值。
其次,我需要为按下的按钮设置与 UISegmentedControl 相同的颜色。
[更改 UINavigationItem 颜色](http://www.skylarcantu.com/blog/2009/11/05/changing-colors-of-uinavigationbarbuttons/"更改 UINavigationBarButtons 的颜色") 和为 UISegmentedControl 设置相同的颜色将帮助您到达目的地。
Here是为 UISegmentedControl 设置颜色的示例代码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)