天天看點

iOS 一種自定義顔色的方法

如題:

- (UIColor*)colorWithRGB:(unsignedint)RGBValue

{

    return [UIColorcolorWithRed:((RGBValue&0xFF0000)>>16)/255.0 green:((RGBValue&0xFF00)>>8)/255.0 blue:(RGBValue&0xFF)/255.0alpha:1];

}

調用 

    self.view.backgroundColor = [selfcolorWithRGB:0xAD21F];