gpt4 book ai didi

ios - UIColor colorWithRed :green:blue:alpha: always returns white unless one argument is 0 颜色

转载 作者:可可西里 更新时间:2023-11-01 03:35:27 25 4
gpt4 key购买 nike

我正在使用

[UIColor colorWithRed:136 green:155 blue:218 alpha:1.0]; 

更改我的表格 View 单元格的背景颜色。

但由于某种原因背景只是保持白色。如果我尝试

[UIColor colorWithRed:0 green:155 blue:218 alpha:1.0]; 

颜色变化。这对我来说没有意义。有什么建议或提示吗?

最佳答案

参数不是 0 到 255 之间的值,而是 0.0 到 1.0 之间的 float :

[UIColor colorWithRed:0.0f/255.0f green:155.0f/255.0f blue:218.0f/255.0f alpha:1.0f]; 

关于ios - UIColor colorWithRed :green:blue:alpha: always returns white unless one argument is 0 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7584531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com