【问题标题】:Navigation bar type: the code is?导航栏类型:代码是?
【发布时间】:2012-01-29 11:27:39
【问题描述】:

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

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

【问题讨论】:

    标签: iphone ios uinavigationbar tintcolor


    【解决方案1】:

    这是因为您对 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];
    

    【讨论】:

      猜你喜欢
      • 2016-07-28
      • 2021-08-04
      • 2020-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-18
      • 1970-01-01
      相关资源
      最近更新 更多