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];

原文地址:https://www.cnblogs.com/shidaying/p/5432205.html