导航栏类型:代码是?

时间:2012-01-29 11:27:39

标签: iphone ios uinavigationbar tintcolor

我有一个通过代码创建的导航栏。当我改变它的tintColor时,条形图很糟糕。 Hoverer的颜色很简单,而不是iOS风格。我可以改变吗?感谢

enter image description here

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
   navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:166 blue:208 alpha:1];

1 个答案:

答案 0 :(得分:5)

这是因为您正在调用UIColor的方法需要浮点值介于0.0和1.0之间,而您将直接RBG值作为整数传递:

这将有效:

myNavigationBar.tintColor = [UIColor colorWithRed:((0 * 1.0) / 255) green:((166 * 1.0) / 255) blue:((208 * 1.0) / 255) alpha:1.0];
相关问题