A two-dimensional array of images.


@interface SKTileMapNode : SKNode


SKTileMapNode does the work of laying out predefined tiles in a grid of any size. Typically, you configure 9-slice images (tile groups) in Xcode's SpriteKit scene editor and paint the look of your tile map ahead of time versus configuring the tile map in code.

As with sprite nodes, you can layer tile maps with different blend modes or control it with actions and physics, for example, for the purpose of parallax scrolling. The rendered tile map can be post processed with an SKShader to add effects such as motion blur or atmospheric perspective.

To work with a tile map programmatically, you supply SKTileMapNode with a tile set that defines the tile definitions it can render. Then, fill each tile in the tile map with the fillWithTileGroup: method and set individual tiles with setTileGroup:andTileDefinition:forColumn:row:.


Creating a Tile Map Programmatically

Create a tile map manually instead of loading it from an archived .sks file.

Controlling a Tile Map's On-Screen Position Relative to its Origin


Defines the point in the tile map that corresponds to its position.

Reading or Manually Configuring the Tile Map's Size


The size of each tile in points.


The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.


The number of columns in the tile map


The number of rows in the tile map.

Querying the Tile Map's Properties

- tileRowIndexFromPosition:

Returns the tile map node object’s tile row index for the specified position in points.


The overall size of the tile map.

Tinting a Tile Map


The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by colorBlendFactor.


Controls the blending between the texture and the tile map object’s color. Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.

Lighting a Tile Map

Configure how a sprite is lit when its near a light node.


A mask that defines how the tile map is lit by light nodes in the scene.

Configuring How Alpha Values Blend the Sprite

Change how a sprite uses its alpha value, such as additive blending, that results in the sprite being brighter than it was before.


Defines the blend mode to use when compositing the tile map over other nodes.

Working with Custom Shaders


Defines a shader which is applied to each tile of the tile map.


The values of each attribute associated with the node's attached shader.

- setValue:forAttributeNamed:

Sets an attribute value for an attached shader.

- valueForAttributeNamed:

The value of a shader attribute.


Inherits From

See Also



A single tile that can be repeated in a tile map.


A set of tiles that collectively define one type of terrain.


Rules that describe how various tiles should be placed in a map.


A container for related tile groups.