UIColor 使用起来的坑

我们一般会用 UIColor 的RGB来生成颜色:

[UIColor colorWithRed:220/255 green:220/255 blue:220/255 alpha:1.0];//这样生成的颜色是黑色的,不是我们想要的

以下几种方式都是可以的:

        _pushBtn.backgroundColor = [UIColor colorWithRed:220/255.f green:220/255.f blue:220/255.f alpha:1.0];

        _pushBtn.backgroundColor = [UIColor colorWithRed:220.0/255 green:220.0/255 blue:220.0/255 alpha:1.0];

        _pushBtn.backgroundColor = [UIColor colorWithRed:220.f/255 green:220.f/255 blue:220.f/255 alpha:1.0];

 

 

posted @ 2016-04-25 18:17  shidaying  阅读(337)  评论(0编辑  收藏  举报