diff options
author | Jordan Kiley <jmkiley@users.noreply.github.com> | 2019-04-03 12:37:56 -0700 |
---|---|---|
committer | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-04-03 13:15:04 -0700 |
commit | 14e692c791209f123070c4f0ae6101cbe6acb3f8 (patch) | |
tree | 9fd1fd8be8c7dadca64b4cabec6ed298aae6f518 /platform/ios/src/MGLMapView.mm | |
parent | 70c3abf3cf66cf770bdd58671196518a914ad0bc (diff) | |
download | qtlocation-mapboxgl-14e692c791209f123070c4f0ae6101cbe6acb3f8.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.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index d82b3cd22b..ab9f178380 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -6821,6 +6821,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")); |