Creates an image object from the specified named asset.
- iOS 2.0+
- tvOS 9.0+
- watchOS 2.0+
The name of the image asset or file. For images in asset catalogs, specify the name of the image asset. For PNG images, you may omit the filename extension. For all other file formats, always include the filename extension.
An object containing an unconfigured version of the image, or
nil if the method could not find the specified image.
When searching the asset catalog, this method prefers an asset containing a symbol image over an asset with the same name containing a bitmap image. Because symbol images are supported only in iOS 13 and later, you may include both types of assets in the same asset catalog. The system automatically falls back to the bitmap image on earlier versions of iOS. You cannot use this method to load system symbol images; use the
system method instead.
This method checks 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 creates the image from an available asset catalog or loads it from disk. 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 intend to display an image only once and don't want it added to the system’s cache, create it using the
image method instead. Keeping single-use images out of the system image cache can potentially improve the memory use characteristics of your app.