How can I create a UIColor from a hex string?

后端 未结 30 1677
北恋
北恋 2020-11-22 16:53

How can I create a UIColor from a hexadecimal string format, such as #00FF00?

30条回答
  •  无人共我
    2020-11-22 17:37

    You could use various online tools to convert a HEX string to an actual UIColor. Check out uicolor.org or UI Color Picker. The output would be converted into Objective-C code, like:

    [UIColor colorWithRed:0.93 green:0.80 blue:0.80 alpha:1.0];
    

    Which you could embed in your application. Hope this helps!

提交回复
热议问题