Contents

init(imageNamed:)

Initializes a textured sprite using an image file.

Declaration

convenience init(imageNamed name: String)

Parameters

  • name:

    The name of an image file stored in the app bundle.

Mentioned in

Return Value

A newly initialized sprite object.

Discussion

This method creates a new texture object from the image file and assigns that texture to the texture property, the normalTexture properties is set to nil. The size property of the sprite is set to the dimensions of the image. The color property is set to white with an alpha of zero (1.0,1.0,1.0,0.0).

See Also

Creating a Sprite from an Image Filename