【问题标题】:UITableViewCell background color only working with the preset color methodsUITableViewCell 背景颜色仅适用于预设颜色方法
【发布时间】:2011-09-17 23:45:31
【问题描述】:

在 UITableViewCell 背景下发生了一些非常奇怪的事情,希望有人知道这是否是一个错误。

如果我将 UITableView 和 UITableViewCell 背景颜色设置为预设颜色方法之一(whiteColor、blackColor 等),它可以正常工作,并且所有行都采用必要的颜色。然而,当我使用 colorWithRed:green:blue:alpha 或 colorWithHue:saturation:brightness:alpha 时,我总是最终得到表格的白色背景。

这是 Apple 代码中的错误还是我只是遗漏了什么?

【问题讨论】:

    标签: ios uitableview uicolor


    【解决方案1】:

    你在 red:green:.... 中添加了什么

    我见过很多使用整数或 0-255 的示例,但这是不正确的。

    [UIColor colorWithRed:0.3 green:0.2 blue:0.2 alpha:1.0]
    

    它们应该在 0-1 的范围内

    【讨论】:

      猜你喜欢
      • 2012-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-20
      • 2017-05-13
      • 1970-01-01
      • 1970-01-01
      • 2014-04-16
      相关资源
      最近更新 更多