refs #892: Cocoa support for map ID style URLs

This commit is contained in:
Justin R. Miller
2015-03-30 16:03:50 -07:00
parent fd5b2dbed0
commit 2782a8ce5b
2 changed files with 20 additions and 0 deletions

View File

@@ -33,6 +33,13 @@
* @return An initialized map view, or `nil` if the map view was unable to be initialized. */
- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken bundledStyleNamed:(NSString *)styleName;
/** Initialize a map view with a given frame, style URL, and access token.
* @param frame The frame with which to initialize the map view.
* @param accessToken A Mapbox API access token.
* @param styleURL The map style URL to use. Can be either an HTTP/HTTPS URL or a Mapbox map ID style URL (`mapbox://<user.style>`).
* @return An initialized map view, or `nil` if the map view was unable to be initialized. */
- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken styleURL:(NSURL *)styleURL;
/** Initialize a map view with a given frame, the default style, and an access token.
* @param frame The frame with which to initialize the map view.
* @param accessToken A Mapbox API access token.

View File

@@ -132,6 +132,19 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
return self;
}
- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken styleURL:(NSURL *)styleURL
{
self = [super initWithFrame:frame];
if (self && [self commonInit])
{
if (accessToken) [self setAccessToken:accessToken];
if (styleURL) [self setStyleURL:[styleURL absoluteString]];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken
{
return [self initWithFrame:frame accessToken:accessToken styleJSON:nil];