Wednesday, April 17, 2013

UIColor colorWithRed:green:blue:alpha: example objc


[UIColor  colorWithRed green blue alpha]
Creates and returns a color object using the specified opacity and RGB component values.
+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha
Parameters of [UIColor  colorWithRed green blue alpha]
red
The red component of the color object, specified as a value from 0.0 to 1.0.
green
The green component of the color object, specified as a value from 0.0 to 1.0.
blue
The blue component of the color object, specified as a value from 0.0 to 1.0.
alpha
The opacity value of the color object, specified as a value from 0.0 to 1.0.

Return Value of [UIColor  colorWithRed green blue alpha]
The color object. The color information represented by this object is in the device RGB colorspace.
Discussion
Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.

Example of [UIColor  colorWithRed green blue alpha]

{
...

    UIColor   *colorForCategoryTextMemo = [UIColor colorWithRed:98.0f/255.0f green:151.0f/255.0f blue:81.0f/255.0f alpha:1.0f];
    UIColor   *colorForCategoryBookmark = [UIColor colorWithRed:233.0f/255.0f green:185.0f/255.0f blue:58.0f/255.0f alpha:1.0f];
    UIColor   *colorForCategoryImage = [UIColor colorWithRed:232.0f/255.0f green:127.0f/255.0f blue:79.0f/255.0f alpha:1.0f];
}