Generally, code like # EE1289 is directly used to represent the RGB color. However, in IOS, the color representation is different. It uses a 0-1 decimal to represent the color value. Such an implementation may indicate more color values, but it undoubtedly increases the amount of code for programmers. When we get # EE1289, it is usually called like this. [UIColor colorWithRed: 0xEE/255.0 green: 0x12/255 .0 blue: 0x89/255 .0 alpha: 1]; this call is too cumbersome, therefore, a small method is encapsulated to directly call/** obtain color */+ (UIColor *) colorWithRGB :( int) color alpha :( float) alpha {return [UIColor colorWithRed :( (Byte) (color> 16)/255.0 green :( (Byte) (color> 8)/255.0 blue :( (Byte) color)/255.0 alpha: alpha];} when using the preceding method, the calling format is as follows: [UIColor colorWithRGB: 0xEE1289 alpha: 1], which is much easier.