diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm index 28ac68589..fc7ad3cb5 100644 --- a/ios/app/MBXViewController.mm +++ b/ios/app/MBXViewController.mm @@ -85,7 +85,7 @@ mbgl::Settings_NSUserDefaults *settings = nullptr; [titleButton addTarget:self action:@selector(cycleStyles) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.titleView = titleButton; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"locateUser.png"] + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"TrackingLocationOffMask.png"] style:UIBarButtonItemStylePlain target:self action:@selector(locateUser)]; @@ -290,6 +290,27 @@ mbgl::Settings_NSUserDefaults *settings = nullptr; return YES; } +- (void)mapView:(MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated +{ + UIImage *newButtonImage; + + switch (mode) { + case MGLUserTrackingModeNone: + newButtonImage = [UIImage imageNamed:@"TrackingLocationOffMask.png"]; + break; + + case MGLUserTrackingModeFollow: + newButtonImage = [UIImage imageNamed:@"TrackingLocationMask.png"]; + break; + + case MGLUserTrackingModeFollowWithHeading: + newButtonImage = [UIImage imageNamed:@"TrackingHeadingMask.png"]; + break; + } + + self.navigationItem.rightBarButtonItem.image = newButtonImage; +} + #pragma clang diagnostic pop @end diff --git a/ios/app/img/TrackingHeadingMask.png b/ios/app/img/TrackingHeadingMask.png new file mode 100644 index 000000000..9ec0567a3 Binary files /dev/null and b/ios/app/img/TrackingHeadingMask.png differ diff --git a/ios/app/img/TrackingHeadingMask@2x.png b/ios/app/img/TrackingHeadingMask@2x.png new file mode 100644 index 000000000..0df8ccc22 Binary files /dev/null and b/ios/app/img/TrackingHeadingMask@2x.png differ diff --git a/ios/app/img/TrackingHeadingMask@3x.png b/ios/app/img/TrackingHeadingMask@3x.png new file mode 100644 index 000000000..e4b93e42e Binary files /dev/null and b/ios/app/img/TrackingHeadingMask@3x.png differ diff --git a/ios/app/img/TrackingLocationMask.png b/ios/app/img/TrackingLocationMask.png new file mode 100644 index 000000000..bb7348c48 Binary files /dev/null and b/ios/app/img/TrackingLocationMask.png differ diff --git a/ios/app/img/TrackingLocationMask@2x.png b/ios/app/img/TrackingLocationMask@2x.png new file mode 100644 index 000000000..35c5a293e Binary files /dev/null and b/ios/app/img/TrackingLocationMask@2x.png differ diff --git a/ios/app/img/TrackingLocationMask@3x.png b/ios/app/img/TrackingLocationMask@3x.png new file mode 100644 index 000000000..af523975a Binary files /dev/null and b/ios/app/img/TrackingLocationMask@3x.png differ diff --git a/ios/app/img/TrackingLocationOffMask.png b/ios/app/img/TrackingLocationOffMask.png new file mode 100644 index 000000000..87b26c571 Binary files /dev/null and b/ios/app/img/TrackingLocationOffMask.png differ diff --git a/ios/app/img/TrackingLocationOffMask@2x.png b/ios/app/img/TrackingLocationOffMask@2x.png new file mode 100644 index 000000000..232d534b4 Binary files /dev/null and b/ios/app/img/TrackingLocationOffMask@2x.png differ diff --git a/ios/app/img/TrackingLocationOffMask@3x.png b/ios/app/img/TrackingLocationOffMask@3x.png new file mode 100644 index 000000000..b609fbe84 Binary files /dev/null and b/ios/app/img/TrackingLocationOffMask@3x.png differ diff --git a/ios/app/img/locateUser.png b/ios/app/img/locateUser.png deleted file mode 100644 index aa8d1cf52..000000000 Binary files a/ios/app/img/locateUser.png and /dev/null differ diff --git a/ios/app/img/locateUser@2x.png b/ios/app/img/locateUser@2x.png deleted file mode 100644 index 29c490593..000000000 Binary files a/ios/app/img/locateUser@2x.png and /dev/null differ diff --git a/ios/app/img/locateUser@3x.png b/ios/app/img/locateUser@3x.png deleted file mode 100644 index 206a5ae80..000000000 Binary files a/ios/app/img/locateUser@3x.png and /dev/null differ