Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Added action to reload style
Browse files Browse the repository at this point in the history
Fixes #3102.
  • Loading branch information
1ec5 committed Apr 18, 2016
1 parent a392f97 commit 947f28f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
14 changes: 14 additions & 0 deletions platform/ios/include/MGLMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,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.
Expand Down
6 changes: 6 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ - (void)setStyleURL:(nullable NSURL *)styleURL
_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;
Expand Down

0 comments on commit 947f28f

Please sign in to comment.