How can I create a UIColor from a hex string?

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

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

30条回答
  •  清酒与你
    2020-11-22 17:39

    There is no builtin conversion from a hexadecimal string to a UIColor (or CGColor) that I'm aware of. However, you can easily write a couple of functions for this purpose - for example, see iphone development accessing uicolor components

提交回复
热议问题