Instance Method

newTextureWithName:scaleFactor:bundle:options:completionHandler:

Asynchronously loads image data and creates a Metal texture from the named texture asset in an asset catalog.

Declaration

- (void)newTextureWithName:(NSString *)name scaleFactor:(CGFloat)scaleFactor bundle:(NSBundle *)bundle options:(NSDictionary<MTKTextureLoaderOption, id> *)options completionHandler:(MTKTextureLoaderCallback)completionHandler;

Parameters

name

The name of a texture in an asset catalog.

scaleFactor

The scale factor of texture to request.

In iOS and tvOS, pass the contentsScale value of the view where you plan to display texture content.

In macOS, pass the backingScaleFactor value of the window where you plan to display texture content.

bundle

The resource bundle containing the asset catalog to load the texture from.

options

A dictionary describing any additional texture loading steps. See Texture Loading Options.

When using this method, the texture loader ignores the MTKTextureLoaderOptionGenerateMipmaps, MTKTextureLoaderOptionSRGB, MTKTextureLoaderOptionCubeLayout, and MTKTextureLoaderOptionOrigin options.

completionHandler

A block called when the texture has been loaded and fully initialized.

See Also

Loading Textures from Asset Catalogs

- newTextureWithName:scaleFactor:bundle:options:error:

Synchronously loads image data and creates a Metal texture from the named texture asset in an asset catalog.

- newTexturesWithNames:scaleFactor:bundle:options:completionHandler:

Asynchronously loads image data and creates Metal textures from the specified list of named texture assets in an asset catalog.

- newTextureWithName:scaleFactor:displayGamut:bundle:options:error:

Synchronously loads image data and creates a Metal texture from the named texture asset in an asset catalog, using a specified display gamut.

- newTextureWithName:scaleFactor:displayGamut:bundle:options:completionHandler:

Asynchronously loads image data and creates a Metal texture from the named texture asset in an asset catalog.

- newTexturesWithNames:scaleFactor:displayGamut:bundle:options:completionHandler:

Asynchronously loads image data and creates Metal textures from the specified list of named texture assets in an asset catalog.