Instance Method

initWithColor:

Initializes a Core Image color object using a UIKit (or AppKit) color object.

Declaration

iOS, Mac Catalyst, tvOS
- (instancetype)initWithColor:(UIColor *)color;
macOS
- (instancetype)initWithColor:(NSColor *)color;

Parameters

color

The initial color value, which can belong to any available color space.

Return Value

The resulting Core Image color, or (in macOS only) nil if the specified color cannot be converted.

Discussion

In iOS and tvOS, this initializer takes a UIColor object and always returns a corresponding Core Image color object.

In macOS, this initializer takes an NSColor object. some possible NSColor configurations cannot be accurately represented as Core Image (or Core Graphics) colors—in such cases, this initializer returns nil.

See Also

Initializing Color Objects

- initWithCGColor:

Initializes a Core Image color object with a Core Graphics color.

- initWithRed:green:blue:

Initializes a Core Image color object with the specified red, green, and blue component values.

- initWithRed:green:blue:alpha:

Initializes a Core Image color object with the specified red, green, blue, and alpha component values.

- initWithRed:green:blue:colorSpace:

Initializes a Core Image color object with the specified red, green, and blue component values as measured in the specified color space.

- initWithRed:green:blue:alpha:colorSpace:

Initializes a Core Image color object with the specified red, green, blue, and alpha component values as measured in the specified color space.