How can I use UIColorFromRGB in Swift?

后端 未结 20 821
一生所求
一生所求 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:12

    This is a nice extension for UIColor. You can use enum values(hex, string) and direct string values when you creating UIColor objects.

    The extension we deserve https://github.com/ioramashvili/UsefulExtensions/blob/master/Extensions.playground/Pages/UIColor.xcplaygroundpage/Contents.swift

提交回复
热议问题