Returns the image object associated with the specified filename.
- iOS 2.0+
- tvOS 9.0+
- watchOS 2.0+
The name of the file. If this is the first time the image is being loaded, the method looks for an image with the specified name in the application’s main bundle. For PNG images, you may omit the filename extension. For all other file formats, always include the filename extension.
The image object for the specified file, or
nil if the method could not find the specified image.
This method looks in the system caches for an image object with the specified name and returns the variant of that image that is best suited for the main screen. If a matching image object is not already in the cache, this method locates and loads the image data from disk or from an available asset catalog, and then returns the resulting object.
The system may purge cached image data at any time to free up memory. Purging occurs only for images that are in the cache but are not currently being used.
In iOS 9 and later, this method is thread safe.
If you have an image file that will only be displayed once and wish to ensure that it does not get added to the system’s cache, you should instead create your image using
image. This will keep your single-use image out of the system image cache, potentially improving the memory use characteristics of your app.