summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
authorJordan Kiley <jmkiley@users.noreply.github.com>2019-04-03 12:37:56 -0700
committerFabian Guerra Soto <fabian.guerra@mapbox.com>2019-04-03 12:37:56 -0700
commit1aa705c2f6124584b6dc562fd2cfc0c40dba8df8 (patch)
treebe9e33b3346f91604b3bc5a04e6d6ae853ba13e0 /platform/ios/src/MGLMapView.mm
parentf3c3dc49e231208e75db64b53c5e92bb9647a661 (diff)
downloadqtlocation-mapboxgl-1aa705c2f6124584b6dc562fd2cfc0c40dba8df8.tar.gz
[ios] Add iOS bindings and example for missing icons event. (#14302)
Added a new mapView delegate method that allows reload a style icon in case it couldn't load it from the style. Added an iosapp test example.
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 813762c499..715929818f 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -6827,6 +6827,20 @@ public:
void onDidFinishLoadingStyle() override {
[nativeView didFinishLoadingStyle];
}
+
+ void onStyleImageMissing(const std::string& imageIdentifier) override {
+ NSString *imageName = [NSString stringWithUTF8String:imageIdentifier.c_str()];
+
+ if ([nativeView.delegate respondsToSelector:@selector(mapView:didFailToLoadImage:)]) {
+ UIImage *imageToLoad = [nativeView.delegate mapView:nativeView didFailToLoadImage:imageName];
+
+ if (imageToLoad) {
+ auto image = [imageToLoad mgl_styleImageWithIdentifier:imageName];
+ nativeView.mbglMap.getStyle().addImage(std::move(image));
+ }
+
+ }
+ }
mbgl::gl::ProcAddress getExtensionFunctionPointer(const char* name) override {
static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles"));