From 6eb79338f3298de8f0137125783f505f3cb9b407 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 2 Apr 2015 16:15:36 -0700 Subject: [PATCH] allow setting nil mapID for default style --- include/mbgl/ios/MGLMapView.h | 4 +++- platform/ios/MGLMapView.mm | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h index 3ee1b4e9d..5db1f425d 100644 --- a/include/mbgl/ios/MGLMapView.h +++ b/include/mbgl/ios/MGLMapView.h @@ -176,7 +176,9 @@ IB_DESIGNABLE /** URL of the style currently displayed in the receiver. * -* The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://`). To display the default style, set this property to `nil`. */ +* The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://`). +* +* To display the default style, set this property to `nil`. */ @property (nonatomic) NSURL *styleURL; #pragma mark - Annotating the Map diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 63ed8e11a..18937b94f 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -1332,7 +1332,14 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng) - (void)setMapID:(NSString *)mapID { - self.styleURL = [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://%@", mapID]]; + if (mapID) + { + self.styleURL = [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://%@", mapID]]; + } + else + { + self.styleURL = nil; + } } - (NSArray *)getAppliedStyleClasses