An overlay that covers an area of the map with bitmap tiles.


class MKTileOverlay : NSObject


You use tile overlay objects to represent your own tile-based content and to coordinate the display of that content in a map view. Your tiles can supplement the underlying map content or replace it completely. A tile overlay object coordinates the loading and management of the tiles while a corresponding MKTileOverlayRenderer object handles the actual drawing of the tiles on the map.

You can use a single tile overlay object to represent all of the tiles at one or more zoom levels of the map. The default tile overlay object uses a template string to build URLs so that it can locate the map tiles it needs. Each URL incorporates the x and y index of the map tile, the zoom level it is intended for, and the scale factor corresponding to the screen resolution on which to display the tile. The default class lets you specify map tiles whose indexes start in either the upper-left corner or lower-left corner of the map. If you use a different indexing scheme for your tiles, you can also subclass and override the url(forTilePath:) or loadTile(at:result:) methods to map between the requested tile and your custom indexing scheme.


Creating a Tile Overlay

init(urlTemplate: String?)

Initializes and returns a tile overlay object using the specified tile-access template.

Accessing the Tile Attributes

var tileSize: CGSize

The size (in pixels) of your tile images.

var isGeometryFlipped: Bool

A Boolean value that indicates the orientation of tile indexes along the y axis.

var minimumZ: Int

The minimum zoom level supported by the tiles of this overlay object.

var maximumZ: Int

The maximum zoom level supported by the tiles of this overlay object.

var canReplaceMapContent: Bool

A Boolean value that indicates whether the tile content is fully opaque.

Customizing the Loading of Tiles

var urlTemplate: String?

The template for generating tile image URLs.

func url(forTilePath: MKTileOverlayPath) -> URL

Returns the URL to use to access the specified tile.

struct MKTileOverlayPath

Use this structure to specify the index values for a single tile.


Inherits From

See Also

Tiled Images

class MKTileOverlayRenderer

The renderer for a tile overlay that handles the drawing of bitmap images on the map surface.