Class: UIColor
Overview
Instance Attribute Summary (collapse)
-
- CGColor
readonly
The Quartz color reference that corresponds to the receiver’s color.
-
- CIColor
readonly
The Core Image color associated with the receiver.
Class Method Summary (collapse)
-
+ blackColor
Returns a color object whose grayscale value is 0.0 and whose alpha value is 1.0.
-
+ blueColor
Returns a color object whose RGB values are 0.0, 0.0, and 1.0 and whose alpha value is 1.0.
-
+ brownColor
Returns a color object whose RGB values are 0.6, 0.4, and 0.2 and whose alpha value is 1.0.
-
+ clearColor
Returns a color object whose grayscale and alpha values are both 0.0.
-
+ colorWithCGColor:
Creates and returns a color object using the specified Quartz color reference.
-
+ colorWithCIColor:
Converts a Core Image color object to its UIColor equivalent.
-
+ colorWithHue:saturation:brightness:alpha:
Creates and returns a color object using the specified opacity and HSB color space component values.
-
+ colorWithPatternImage:
Creates and returns a color object using the specified image.
-
+ colorWithRed:green:blue:alpha:
Creates and returns a color object using the specified opacity and RGB component values.
-
+ colorWithWhite:alpha:
Creates and returns a color object using the specified opacity and grayscale values.
-
+ cyanColor
Returns a color object whose RGB values are 0.0, 1.0, and 1.0 and whose alpha value is 1.0.
-
+ darkGrayColor
Returns a color object whose grayscale value is 1/3 and whose alpha value is 1.0.
-
+ darkTextColor
Returns the system color used for displaying text on a light background.
-
+ grayColor
Returns a color object whose grayscale value is 0.5 and whose alpha value is 1.0.
-
+ greenColor
Returns a color object whose RGB values are 0.0, 1.0, and 0.0 and whose alpha value is 1.0.
-
+ groupTableViewBackgroundColor
Returns the system color used for the background of a grouped table.
-
+ lightGrayColor
Returns a color object whose grayscale value is 2/3 and whose alpha value is 1.0.
-
+ lightTextColor
Returns the system color used for displaying text on a dark background.
-
+ magentaColor
Returns a color object whose RGB values are 1.0, 0.0, and 1.0 and whose alpha value is 1.0.
-
+ orangeColor
Returns a color object whose RGB values are 1.0, 0.5, and 0.0 and whose alpha value is 1.0.
-
+ purpleColor
Returns a color object whose RGB values are 0.5, 0.0, and 0.5 and whose alpha value is 1.0.
-
+ redColor
Returns a color object whose RGB values are 1.0, 0.0, and 0.0 and whose alpha value is 1.0.
-
+ scrollViewTexturedBackgroundColor
Returns the system pattern color used to render the area behind scrollable content.
-
+ underPageBackgroundColor
Returns the system pattern color used to render the background of a page.
-
+ viewFlipsideBackgroundColor
Returns the system color used for the back side of a view while it is being flipped.
-
+ whiteColor
Returns a color object whose grayscale value is 1.0 and whose alpha value is 1.0.
-
+ yellowColor
Returns a color object whose RGB values are 1.0, 1.0, and 0.0 and whose alpha value is 1.0.
Instance Method Summary (collapse)
-
- colorWithAlphaComponent:
Creates and returns a color object that has the same color space and component values as the receiver, but has the specified alpha component.
-
- getHue:saturation:brightness:alpha:
Returns the components that make up the color in the HSB color space.
-
- getRed:green:blue:alpha:
Returns the components that make up the color in the RGB color space.
-
- getWhite:alpha:
Returns the grayscale components of the color.
-
- initWithCGColor:
Initializes and returns a color object using the specified Quartz color reference.
-
- initWithCIColor:
Initializes and returns a color object using the specified Core Image color.
-
- initWithHue:saturation:brightness:alpha:
Initializes and returns a color object using the specified opacity and HSB color space component values.
-
- initWithPatternImage:
Initializes and returns a color object using the specified Quartz color reference.
-
- initWithRed:green:blue:alpha:
Initializes and returns a color object using the specified opacity and RGB component values.
-
- initWithWhite:alpha:
Initializes and returns a color object using the specified opacity and grayscale values.
-
- set
Sets the color of subsequent stroke and fill operations to the color that the receiver represents.
-
- setFill
Sets the color of subsequent fill operations to the color that the receiver represents.
-
- setStroke
Sets the color of subsequent stroke operations to the color that the receiver represents.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (CGColorRef) CGColor (readonly)
The Quartz color reference that corresponds to the receiver’s color. (read-only)
- (CIColor) CIColor (readonly)
The Core Image color associated with the receiver. (read-only) This property throws an exception if the color object was not initialized with a Core Image color.
Class Method Details
+ (UIColor) blackColor
Returns a color object whose grayscale value is 0.0 and whose alpha value is 1.0.
+ (UIColor) blueColor
Returns a color object whose RGB values are 0.0, 0.0, and 1.0 and whose alpha value is 1.0.
+ (UIColor) brownColor
Returns a color object whose RGB values are 0.6, 0.4, and 0.2 and whose alpha value is 1.0.
+ (UIColor) clearColor
Returns a color object whose grayscale and alpha values are both 0.0.
+ (UIColor) colorWithCGColor(cgColor)
Creates and returns a color object using the specified Quartz color reference.
+ (UIColor) colorWithHue(hue, saturation:saturation, brightness:brightness, alpha:alpha)
Creates and returns a color object using the specified opacity and HSB color space component values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
+ (UIColor) colorWithPatternImage(image)
Creates and returns a color object using the specified image. You can use pattern colors to set the fill or stroke color just as you would a solid color. During drawing, the image in the pattern color is tiled as necessary to cover the given area. By default, the phase of the returned color is 0, which causes the top-left corner of the image to be aligned with the drawing origin. To change the phase, make the color the current color and then use the CGContextSetPatternPhase function to change the phase.
+ (UIColor) colorWithRed(red, green:green, blue:blue, alpha:alpha)
Creates and returns a color object using the specified opacity and RGB component values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
+ (UIColor) colorWithWhite(white, alpha:alpha)
Creates and returns a color object using the specified opacity and grayscale values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
+ (UIColor) cyanColor
Returns a color object whose RGB values are 0.0, 1.0, and 1.0 and whose alpha value is 1.0.
+ (UIColor) darkGrayColor
Returns a color object whose grayscale value is 1/3 and whose alpha value is 1.0.
+ (UIColor) darkTextColor
Returns the system color used for displaying text on a light background.
+ (UIColor) grayColor
Returns a color object whose grayscale value is 0.5 and whose alpha value is 1.0.
+ (UIColor) greenColor
Returns a color object whose RGB values are 0.0, 1.0, and 0.0 and whose alpha value is 1.0.
+ (UIColor) groupTableViewBackgroundColor
Returns the system color used for the background of a grouped table.
+ (UIColor) lightGrayColor
Returns a color object whose grayscale value is 2/3 and whose alpha value is 1.0.
+ (UIColor) lightTextColor
Returns the system color used for displaying text on a dark background.
+ (UIColor) magentaColor
Returns a color object whose RGB values are 1.0, 0.0, and 1.0 and whose alpha value is 1.0.
+ (UIColor) orangeColor
Returns a color object whose RGB values are 1.0, 0.5, and 0.0 and whose alpha value is 1.0.
+ (UIColor) purpleColor
Returns a color object whose RGB values are 0.5, 0.0, and 0.5 and whose alpha value is 1.0.
+ (UIColor) redColor
Returns a color object whose RGB values are 1.0, 0.0, and 0.0 and whose alpha value is 1.0.
+ (UIColor) scrollViewTexturedBackgroundColor
Returns the system pattern color used to render the area behind scrollable content.
+ (UIColor) underPageBackgroundColor
Returns the system pattern color used to render the background of a page.
+ (UIColor) viewFlipsideBackgroundColor
Returns the system color used for the back side of a view while it is being flipped.
+ (UIColor) whiteColor
Returns a color object whose grayscale value is 1.0 and whose alpha value is 1.0.
+ (UIColor) yellowColor
Returns a color object whose RGB values are 1.0, 1.0, and 0.0 and whose alpha value is 1.0.
Instance Method Details
- (UIColor) colorWithAlphaComponent(alpha)
Creates and returns a color object that has the same color space and component values as the receiver, but has the specified alpha component. A subclass with explicit opacity components should override this method to return a color with the specified alpha.
- (Boolean) getHue(hue, saturation:saturation, brightness:brightness, alpha:alpha)
Returns the components that make up the color in the HSB color space. If the color is in a compatible color space, the color is converted into the HSB color space and its components are returned to your application. If the color is not in a compatible color space, the parameters are unchanged.
- (Boolean) getRed(red, green:green, blue:blue, alpha:alpha)
Returns the components that make up the color in the RGB color space. If the color is in a compatible color space, the color is converted into RGB format and its components are returned to your application. If the color is not in a compatible color space, the parameters are unchanged.
- (Boolean) getWhite(white, alpha:alpha)
Returns the grayscale components of the color. If the color is in a compatible color space, the color is converted into grayscale format and returned to your application. If the color is not in a compatible color space, the parameters are unchanged.
- (UIColor) initWithCGColor(cgColor)
Initializes and returns a color object using the specified Quartz color reference.
- (UIColor) initWithCIColor(ciColor)
Initializes and returns a color object using the specified Core Image color.
- (UIColor) initWithHue(hue, saturation:saturation, brightness:brightness, alpha:alpha)
Initializes and returns a color object using the specified opacity and HSB color space component values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
- (UIColor) initWithPatternImage(image)
Initializes and returns a color object using the specified Quartz color reference. You can use pattern colors to set the fill or stroke color just as you would a solid color. During drawing, the image in the pattern color is tiled as necessary to cover the given area. By default, the phase of the returned color is 0, which causes the top-left corner of the image to be aligned with the drawing origin. To change the phase, make the color the current color and then use the CGContextSetPatternPhase function to change the phase.
- (UIColor) initWithRed(red, green:green, blue:blue, alpha:alpha)
Initializes and returns a color object using the specified opacity and RGB component values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
- (UIColor) initWithWhite(white, alpha:alpha)
Initializes and returns a color object using the specified opacity and grayscale values. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
- (Object) set
Sets the color of subsequent stroke and fill operations to the color that the receiver represents. If you subclass UIColor, you must implement this method in your subclass. Your custom implementation should modify both the stroke and fill color in the current graphics context by setting them both to the color represented by the receiver.
- (Object) setFill
Sets the color of subsequent fill operations to the color that the receiver represents. If you subclass UIColor, you must implement this method in your subclass. Your custom implementation should modify the fill color in the current graphics context by setting it to the color represented by the receiver.
- (Object) setStroke
Sets the color of subsequent stroke operations to the color that the receiver represents. If you subclass UIColor, you must implement this method in your subclass. Your custom implementation should modify the stroke color in the current graphics context by setting it to the color represented by the receiver.