How can I use UIColorFromRGB in Swift?

后端 未结 20 776
一生所求
一生所求 2020-12-04 05:48

In Objective-C, we use this code to set RGB color codes for views:

#define UIColorFromRGB(rgbValue)        
[UIColor colorWithRed:((float)((rgbValue & 0x         


        
20条回答
  •  春和景丽
    2020-12-04 06:15

    UIColorFromRGB in Swift 4

    button.layer.backgroundColor = UIColor(red: 112.0/255, green: 86.0/255, blue: 164.0/255, alpha: 1.0).cgColor
    

提交回复
热议问题