UIColorをHTMLっぽく16進数でインスタンス生成する

simonwhitaker/UIColor+GSAdditions.hjnutting氏のコメントを元に少し追加した。

こんな風に書けます。

[UIColor colorWithRGBHex:0xff0000];    // red
[UIColor colorWithRGBAHex:0x00ff00ff]; // green
[UIColor colorWithRGBAHex:0x0000FF80]; // translucent blue

gistにアップロードしておいた。
https://gist.github.com/4593832

Pocket
LINEで送る
LinkedIn にシェア