LoginSignup
18
18

More than 5 years have passed since last update.

UIColorのRGBマクロ

Last updated at Posted at 2012-11-12

※20121112 指摘事項を修正

RGBカラー指定のマクロ。hファイルや、Prefix.pchファイルに以下を記述する。

#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]

使用する際は、以下のようにしてカラーを指定する。

UIColor *color = RGB(255,100,50);
18
18
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
18