New basemap styling is coming soon to Google Maps Platform. This update to map styling includes a new default color palette, modernized pins, and improvements to map experiences and usability. All map styles will be automatically updated in March 2025. For more information on availability and how to opt in earlier, see
New map style for Google Maps Platform.
GoogleMaps Framework Reference
GMSURLTileLayer
GMSURLTileProvider
fetches tiles based on the URLs returned from a GMSTileURLConstructor
. For
example:
GMSTileURLConstructor constructor = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
NSString *URLStr =
[NSString stringWithFormat:@"https://example.com/%d/%d/%d.png", x, y, zoom];
return [NSURL URLWithString:URLStr];
};
GMSTileLayer *layer =
[GMSURLTileLayer tileLayerWithURLConstructor:constructor];
layer.userAgent = @"SDK user agent";
layer.map = map;
GMSURLTileProvider
may not be subclassed and should only be created via its convenience
constructor.
-
Convenience constructor. constructor
must be non-nil.
Declaration
Objective-C
+ (nonnull instancetype)tileLayerWithURLConstructor:
(nonnull GMSTileURLConstructor)constructor;
-
Specify the user agent to describe your application. If this is nil (the default), the default
iOS user agent is used for HTTP requests.
Declaration
Swift
var userAgent: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *userAgent;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-15 UTC.
[null,null,["Last updated 2024-11-15 UTC."],[[["`GMSURLTileLayer` fetches map tiles using URLs provided by a `GMSTileURLConstructor`."],["You can customize the user agent for HTTP requests made by the tile layer."],["It's easily initialized using a convenience constructor that takes a `GMSTileURLConstructor` to define how tile URLs are generated."],["`GMSURLTileProvider` cannot be subclassed and should only be created using its designated constructor."]]],["`GMSURLTileLayer` fetches tiles using URLs provided by a `GMSTileURLConstructor`. Create instances using `tileLayerWithURLConstructor:`, passing a constructor that returns a URL for given x, y, and zoom levels. The `userAgent` property allows customization of the HTTP request user agent; otherwise, the default iOS agent is used. Subclassing `GMSURLTileProvider` is not supported. A code example demonstrates how to generate the constructor.\n"]]