Stay organized with collections
Save and categorize content based on your preferences.
GMSTileLayer
@interfaceGMSTileLayer:NSObject
GMSTileLayer is an abstract class that allows overlaying of custom image tiles on a specified
GMSMapView. It may not be initialized directly, and subclasses must implement the
tileForX:y:zoom: method to return tiles.
At zoom level 0 the whole world is a square covered by a single tile, and the coordinates x and
y are both 0 for that tile. At zoom level 1, the world is covered by 4 tiles with x and y
being 0 or 1, and so on.
-requestTileForX:y:zoom:receiver: generates image tiles for GMSTileOverlay. It must be
overridden by subclasses. The tile for the given x, y and zoommust be later passed to
receiver.
Specify kGMSTileLayerNoTile if no tile is available for this location; or nil if a transient
error occurred and a tile may be available later.
Calls to this method will be made on the main thread. See GMSSyncTileLayer for a base class
that implements a blocking tile layer that does not run on your application’s main thread.
The map this GMSTileOverlay is displayed on. Setting this property will add the layer to the
map. Setting it to nil removes this layer from the map. A layer may be active on at most one map
at any given time.
Specifies the number of pixels (not points) that the returned tile images will prefer to display
as. For best results, this should be the edge length of your custom tiles. Defaults to 256, which
is the traditional size of Google Maps tiles.
Values less than the equivalent of 128 points (e.g. 256 pixels on retina devices) may not perform
well and are not recommended.
As an example, an application developer may wish to provide retina tiles (512 pixel edge length)
on retina devices, to keep the same number of tiles
per view as the default value of 256 would give on a non-retina device.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-15 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSTileLayer\u003c/code\u003e is an abstract class used to overlay custom image tiles on a \u003ccode\u003eGMSMapView\u003c/code\u003e, requiring subclasses to implement the \u003ccode\u003erequestTileForX:y:zoom:receiver:\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eTiles are organized by zoom levels, with zoom level 0 representing the entire world as a single tile and increasing zoom levels subdividing the map into more tiles.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGMSTileLayer\u003c/code\u003e offers properties to control its appearance and behavior, such as \u003ccode\u003emap\u003c/code\u003e for attaching to a map view, \u003ccode\u003ezIndex\u003c/code\u003e for layering, \u003ccode\u003etileSize\u003c/code\u003e for tile dimensions, \u003ccode\u003eopacity\u003c/code\u003e for transparency, and \u003ccode\u003efadeIn\u003c/code\u003e for visual transitions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can clear the tile cache using the \u003ccode\u003eclearTileCache\u003c/code\u003e method, prompting the layer to request and display new tiles.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003erequestTileForX:y:zoom:receiver:\u003c/code\u003e method, central to \u003ccode\u003eGMSTileLayer\u003c/code\u003e subclasses, is invoked to fetch tiles for specific coordinates and zoom levels, with the result provided to the designated receiver.\u003c/p\u003e\n"]]],[],null,["GMSTileLayer \n\n @interface GMSTileLayer : NSObject\n\n`GMSTileLayer` is an abstract class that allows overlaying of custom image tiles on a specified\n[GMSMapView](../Classes/GMSMapView.html). It may not be initialized directly, and subclasses must implement the\ntileForX:y:zoom: method to return tiles.\n\nAt zoom level 0 the whole world is a square covered by a single tile, and the coordinates `x` and\n`y` are both 0 for that tile. At zoom level 1, the world is covered by 4 tiles with `x` and `y`\nbeing 0 or 1, and so on.\n- `\n ``\n ``\n `\n\n [-requestTileForX:y:zoom:receiver:](#/c:objc(cs)GMSTileLayer(im)requestTileForX:y:zoom:receiver:)`\n ` \n `-requestTileForX:y:zoom:receiver:` generates image tiles for `GMSTileOverlay`. It must be\n overridden by subclasses. The tile for the given `x`, `y` and `zoom` *must* be later passed to\n `receiver`.\n\n Specify [kGMSTileLayerNoTile](../Constants/kGMSTileLayerNoTile.html) if no tile is available for this location; or nil if a transient\n error occurred and a tile may be available later.\n\n Calls to this method will be made on the main thread. See [GMSSyncTileLayer](../Classes/GMSSyncTileLayer.html) for a base class\n that implements a blocking tile layer that does not run on your application's main thread. \n\n Declaration \n Swift \n\n func requestTileFor(x: UInt, y: UInt, zoom: UInt, receiver: any ../Protocols/GMSTileReceiver.html)\n\n Objective-C \n\n - (void)requestTileForX:(NSUInteger)x\n y:(NSUInteger)y\n zoom:(NSUInteger)zoom\n receiver:(nonnull id\u003c../Protocols/GMSTileReceiver.html\u003e)receiver;\n\n- `\n ``\n ``\n `\n\n [-clearTileCache](#/c:objc(cs)GMSTileLayer(im)clearTileCache)`\n ` \n Clears the cache so that all tiles will be requested again. \n\n Declaration \n Swift \n\n func clearTileCache()\n\n Objective-C \n\n - (void)clearTileCache;\n\n- `\n ``\n ``\n `\n\n [map](#/c:objc(cs)GMSTileLayer(py)map)`\n ` \n The map this `GMSTileOverlay` is displayed on. Setting this property will add the layer to the\n map. Setting it to nil removes this layer from the map. A layer may be active on at most one map\n at any given time. \n\n Declaration \n Swift \n\n weak var map: ../Classes/GMSMapView.html? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) ../Classes/GMSMapView.html *map;\n\n- `\n ``\n ``\n `\n\n [zIndex](#/c:objc(cs)GMSTileLayer(py)zIndex)`\n ` \n Higher `zIndex` value tile layers will be drawn on top of lower `zIndex` value tile layers and\n overlays. Equal values result in undefined draw ordering. \n\n Declaration \n Swift \n\n var zIndex: Int32 { get set }\n\n Objective-C \n\n @property (nonatomic) int zIndex;\n\n- `\n ``\n ``\n `\n\n [tileSize](#/c:objc(cs)GMSTileLayer(py)tileSize)`\n ` \n Specifies the number of pixels (not points) that the returned tile images will prefer to display\n as. For best results, this should be the edge length of your custom tiles. Defaults to 256, which\n is the traditional size of Google Maps tiles.\n\n Values less than the equivalent of 128 points (e.g. 256 pixels on retina devices) may not perform\n well and are not recommended.\n\n As an example, an application developer may wish to provide retina tiles (512 pixel edge length)\n on retina devices, to keep the same number of tiles\n per view as the default value of 256 would give on a non-retina device. \n\n Declaration \n Swift \n\n var tileSize: Int { get set }\n\n Objective-C \n\n @property (nonatomic) NSInteger tileSize;\n\n- `\n ``\n ``\n `\n\n [opacity](#/c:objc(cs)GMSTileLayer(py)opacity)`\n ` \n Specifies the opacity of the tile layer. This provides a multiplier for the alpha channel of tile\n images. \n\n Declaration \n Swift \n\n var opacity: Float { get set }\n\n Objective-C \n\n @property (nonatomic) float opacity;\n\n- `\n ``\n ``\n `\n\n [fadeIn](#/c:objc(cs)GMSTileLayer(py)fadeIn)`\n ` \n Specifies whether the tiles should fade in. Default YES. \n\n Declaration \n Swift \n\n var fadeIn: Bool { get set }\n\n Objective-C \n\n @property (nonatomic) BOOL fadeIn;"]]