Instance Method

initWithTexture:

Initializes a textured sprite using an existing texture object.

Declaration

- (instancetype)initWithTexture:(SKTexture *)texture;

Parameters

texture

A SpriteKit texture.

Return Value

A newly initialized sprite object.

Discussion

The size property of the sprite is set to the dimensions of the texture. 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 a Texture

- initWithTexture:color:size:

Initializes a colored and textured sprite using an existing texture object.

+ spriteNodeWithColor:size:

Initializes a colored sprite.

+ spriteNodeWithImageNamed:

Initializes a textured sprite using an image file.

+ spriteNodeWithTexture:

Initializes a textured sprite using an existing texture object.

+ spriteNodeWithTexture:size:

Initializes a textured sprite using an existing texture object but with a specified size.

+ spriteNodeWithTexture:normalMap:

Initializes a textured sprite with a normal map to simulate 3D lighting.

texture

The texture used to draw the sprite.