Instance Method

initWithContentsOfFile:

Initializes and returns the image object with the contents of the specified file.

Declaration

- (instancetype)initWithContentsOfFile:(NSString *)path;

Parameters

path

The path to the file. This path should include the filename extension that identifies the type of the image data.

Return Value

An initialized UIImage object, or nil if the method could not find the file or initialize the image from its contents.

Discussion

This method loads the image data into memory and marks it as purgeable. If the data is purged and needs to be reloaded, the image object loads that data again from the specified path.

See Also

Creating and Initializing Image Objects

+ imageWithContentsOfFile:

Creates and returns an image object by loading the image data from the file at the specified path.

+ imageWithData:

Creates and returns an image object that uses the specified image data.

+ imageWithData:scale:

Creates and returns an image object that uses the specified image data and scale factor.

+ imageWithCGImage:

Creates and returns an image object representing the specified Quartz image.

+ imageWithCGImage:scale:orientation:

Creates and returns an image object with the specified scale and orientation factors.

+ imageWithCIImage:

Creates and returns an image object that contains a Core Image object.

+ imageWithCIImage:scale:orientation:

Creates and returns an image object based on a Core Image object and the specified attributes.

- initWithData:

Initializes and returns the image object with the specified data.

- initWithData:scale:

Initializes and returns the image object with the specified data and scale factor.

- initWithCGImage:

Initializes and returns the image object with the specified Quartz image reference.

- initWithCGImage:scale:orientation:

Initializes and returns an image object with the specified scale and orientation factors

- initWithCIImage:

Initializes and returns an image object with the specified Core Image object.

- initWithCIImage:scale:orientation:

Initializes and returns an image object with the specified Core Image object and properties.