2012-06-29 19 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]; 
相关问题