2012-06-29 56 views
3

我正在嘗試設置與此一個UIImageView的背景顏色(應返回一些綠色十歲上下的顏色):的UIColor總是給人白當設置藍色

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

但出於某種原因,這是隻給我白色,似乎每當我設置了藍色它變成白回來,我這樣做的時候,它返回我的黃色,這是正常的:

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

回答

14

好吧,我沒有意識到的UIColor需要從0 - 1浮動,而不是從0 - 255,這工作:

cell.background.backgroundColor = [UIColor colorWithRed:240.0f/255.0f green:245.0f/255.0f blue:254.0f/255.0f alpha:1]; 
相關問題