UIColor Macros
ในการเขียน code Objective-C การกำหนดค่าสี นั้นค่อนข่างยุ่งยาก เราสามารถทำให้ง่ายขึ้นได้โดย
#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]
การนำไปใช้
// Code with macro
msgLabel.textColor = RGB(255, 251, 204);