3

これで UIImageView の背景色を設定しようとしています(緑っぽい色が返されるはずです):

 cell.background.backgroundColor = [UIColor colorWithRed:50 green:200 blue:50 alpha:1];

しかし、何らかの理由でこれは私に白い色しか与えていません。青を設定すると白に戻るようです。これを行うと黄色に戻りますが、これは正常です:

cell.background.backgroundColor = [UIColor colorWithRed:50 green:200 blue:0 alpha:1];
4

1 に答える 1

14

わかりました、UIColor が 0 から 255 ではなく 0 から 1 の浮動小数点数を必要とすることに気づきませんでした。これは機能します。

cell.background.backgroundColor = [UIColor colorWithRed:240.0f/255.0f green:245.0f/255.0f blue:254.0f/255.0f alpha:1];
于 2012-06-29T08:39:39.667 に答える