summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-18 01:54:39 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-18 14:57:09 -0700
commit947f28f8bfca10ad590b99a7ba5d781ca2357ec8 (patch)
treef94ebb7ffea08e648f6ba531ffa6f68f8123a823 /platform
parenta392f972fca0e8d7bedbda8a7fe6410567682195 (diff)
downloadqtlocation-mapboxgl-947f28f8bfca10ad590b99a7ba5d781ca2357ec8.tar.gz
[ios] Added action to reload style
Fixes #3102.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/include/MGLMapView.h14
-rw-r--r--platform/ios/src/MGLMapView.mm6
3 files changed, 21 insertions, 0 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 887802928d..460b24c2d5 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone. If you’d like
- Removed the `armv7s` slice from the SDK to reduce its size. iPhone 5 and iPhone 5c automatically use the `armv7` slice instead. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
- The user dot now moves smoothly between user location updates while user location tracking is disabled. ([#1582](https://github.com/mapbox/mapbox-gl-native/pull/1582))
- User location heading updates now resume properly when an app becomes active again. ([#4674](https://github.com/mapbox/mapbox-gl-native/pull/4674))
+- Added a `-reloadStyle:` action to MGLMapView to force a reload of the current style. ([#4728](https://github.com/mapbox/mapbox-gl-native/pull/4728))
- A more specific user agent string is now sent with style and tile requests. ([#4012](https://github.com/mapbox/mapbox-gl-native/pull/4012))
- Removed unused SVG files from the SDK’s resource bundle. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
diff --git a/platform/ios/include/MGLMapView.h b/platform/ios/include/MGLMapView.h
index 1a17507aeb..c2d6bce4ee 100644
--- a/platform/ios/include/MGLMapView.h
+++ b/platform/ios/include/MGLMapView.h
@@ -136,6 +136,20 @@ IB_DESIGNABLE
@property (nonatomic, null_resettable) NSURL *styleURL;
/**
+ Reloads the style.
+
+ You do not normally need to call this method. The map view automatically
+ responds to changes in network connectivity by reloading the style. You may
+ need to call this method if you change the access token after a style has
+ loaded but before loading a style associated with a different Mapbox account.
+
+ This method does not bust the cache. Even if the style has recently changed on
+ the server, calling this method does not necessarily ensure that the map view
+ reflects those changes.
+ */
+- (IBAction)reloadStyle:(id)sender;
+
+/**
A control indicating the map's direction and allowing the user to manipulate
the direction, positioned in the upper-right corner.
*/
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index a3db891efa..f75e8ee987 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -291,6 +291,12 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
_mbglMap->setStyleURL([[styleURL absoluteString] UTF8String]);
}
+- (IBAction)reloadStyle:(__unused id)sender {
+ NSURL *styleURL = self.styleURL;
+ _mbglMap->setStyleURL("");
+ self.styleURL = styleURL;
+}
+
- (void)commonInit
{
_isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent;