diff options
author | Eric Wolfe <eric.r.wolfe@gmail.com> | 2016-12-18 01:53:38 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-12-18 01:53:38 -0800 |
commit | e2fde9cc4eff3de5ab2f513d0c24ad5471d147e6 (patch) | |
tree | d7f30613c3c58d4c45b64e70a9391cb78e7d30b1 | |
parent | e3a6857937823090a1e1ebf1b326e0f35319f5ec (diff) | |
download | qtlocation-mapboxgl-e2fde9cc4eff3de5ab2f513d0c24ad5471d147e6.tar.gz |
[ios, macos] Document when it's safe to call runtime styling functions (#7335)
* Add notes to wait for map to finish loading before adding sources or layers
* Move style loading notes to class documentation
-rw-r--r-- | platform/darwin/src/MGLStyle.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index f39a7af803..96dd502c30 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -30,14 +30,24 @@ NS_ASSUME_NONNULL_BEGIN static const NSInteger MGLStyleDefaultVersion = 9; /** - The proxy object for the current map style for customization purposes and a - set of convenience methods for creating style URLs of default styles provided - by Mapbox. + The proxy object for the current map style. + + MGLStyle provides a set of convenience methods for changing Mapbox + default styles using `-[MGLMapView styleURL]`. <a href="https://www.mapbox.com/maps/">Learn more about Mapbox default styles</a>. + + It is also possible to directly manipulate the current map style + via `-[MGLMapView style]` by updating the style's data sources or layers. + + @note Wait until the map style has finished loading before modifying a map's + style via any of the MGLStyle instance methods below. + You can use the `MGLMapViewDelegate` methods `-mapViewDidFinishLoadingMap:` + or `-mapView:didFinishLoadingStyle:` as indicators that it's safe + to modify the map's style. */ @interface MGLStyle : NSObject -#pragma mark Accessing Common Styles +#pragma mark Accessing Default Styles /** Returns the URL to version 8 of the @@ -199,8 +209,8 @@ static const NSInteger MGLStyleDefaultVersion = 9; /** Adds a new source to the current style. - - @note Adding the same source instance more than once will result in a + + @note Adding the same source instance more than once will result in a `MGLRedundantSourceException`. Reusing the same source identifier, even with different source instances, will result in a `MGLRedundantSourceIdentifierException`. @@ -251,7 +261,7 @@ static const NSInteger MGLStyleDefaultVersion = 9; /** Adds a new layer on top of existing layers. - + @note Adding the same layer instance more than once will result in a `MGLRedundantLayerException`. Reusing the same layer identifer, even with different layer instances, will also result in an exception. |