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 12:37:56 -0700 |
commit | 1aa705c2f6124584b6dc562fd2cfc0c40dba8df8 (patch) | |
tree | be9e33b3346f91604b3bc5a04e6d6ae853ba13e0 /platform/ios/app/MBXViewController.m | |
parent | f3c3dc49e231208e75db64b53c5e92bb9647a661 (diff) | |
download | qtlocation-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/app/MBXViewController.m')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 9c506cadfa..8d936d6a25 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -103,6 +103,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MBXSettingsMiscellaneousToggleTwoMaps, MBXSettingsMiscellaneousLocalizeLabels, MBXSettingsMiscellaneousShowSnapshots, + MBXSettingsMiscellaneousMissingIcon, MBXSettingsMiscellaneousShouldLimitCameraChanges, MBXSettingsMiscellaneousShowCustomLocationManager, MBXSettingsMiscellaneousOrnamentsPlacement, @@ -499,6 +500,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { [NSString stringWithFormat:@"%@ Second Map", ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")], [NSString stringWithFormat:@"Show Labels in %@", (_localizingLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], @"Show Snapshots", + @"Missing Icon", [NSString stringWithFormat:@"%@ Camera Changes", (_shouldLimitCameraChanges ? @"Unlimit" : @"Limit")], @"View Route Simulation", @"Ornaments Placement", @@ -746,6 +748,11 @@ CLLocationCoordinate2D randomWorldCoordinate() { [self performSegueWithIdentifier:@"ShowSnapshots" sender:nil]; break; } + case MBXSettingsMiscellaneousMissingIcon: + { + [self loadMissingIcon]; + break; + } case MBXSettingsMiscellaneousShowCustomLocationManager: { [self performSegueWithIdentifier:@"ShowCustomLocationManger" sender:nil]; @@ -1718,6 +1725,19 @@ CLLocationCoordinate2D randomWorldCoordinate() { [self.mapView addAnnotation:line]; } +- (void)loadMissingIcon +{ + self.mapView.centerCoordinate = CLLocationCoordinate2DMake(0, 0); + self.mapView.zoomLevel = 1; + NSURL *customStyleJSON = [[NSBundle mainBundle] URLForResource:@"missing_icon" withExtension:@"json"]; + [self.mapView setStyleURL:customStyleJSON]; +} + +- (UIImage *)mapView:(MGLMapView *)mapView didFailToLoadImage:(NSString *)imageName { + UIImage *backupImage = [UIImage imageNamed:@"AppIcon"]; + return backupImage; +} + - (void)printTelemetryLogFile { NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogFilePath] encoding:NSUTF8StringEncoding error:nil]; |