开发者

UITableViewCell odd coloring issue:

开发者 https://www.devze.com 2023-01-20 14:29 出处:网络
Why does this work: - (void)tableView: (UITableView *)tableView willDisplayCell: (UITableViewCell *)cell forRowAtIndexPath: (NSIndexPath *)indexPath {

Why does this work:

- (void)tableView: (UITableView *)tableView willDisplayCell: (UITableViewCell *)cell forRowAtIndexPath: (NSIndexPath *)indexPath {
    cell.backgroundColor = [UIColor redColor];
}

but this doesn't?

- (void)tableView: (UITableView *)tableView willDisplayCell: (UITableViewCell *)cell forRowAtIndexPath: (NSIndexPath *)indexPath {
    cell.backgroundColor开发者_StackOverflow = [UIColor colorWithRed:250 green:100 blue:100 alpha:1];
}

Am I thus constrained to the pre-defined UIColor colours?


use:

cell.backgroundColor = [UIColor colorWithRed:250/255.0 green:100/255.0 blue:100/255.0 alpha:1];

They need to be float.


The values you specify are invalid. Color channel values are floats in the range 0.0f..1.0f.

0

精彩评论

暂无评论...
验证码 换一张
取 消