allow setting nil mapID for default style

This commit is contained in:
Justin R. Miller
2015-04-02 16:15:36 -07:00
committed by Minh Nguyễn
parent 2916ae2735
commit 6eb79338f3
2 changed files with 11 additions and 2 deletions

View File

@@ -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://<user.style>`). 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://<user.style>`).
*
* To display the default style, set this property to `nil`. */
@property (nonatomic) NSURL *styleURL;
#pragma mark - Annotating the Map

View File

@@ -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