Add simple tracking mode button to demo app
@@ -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
|
||||
|
||||
BIN
ios/app/img/TrackingHeadingMask.png
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
ios/app/img/TrackingHeadingMask@2x.png
Normal file
|
After Width: | Height: | Size: 467 B |
BIN
ios/app/img/TrackingHeadingMask@3x.png
Normal file
|
After Width: | Height: | Size: 672 B |
BIN
ios/app/img/TrackingLocationMask.png
Normal file
|
After Width: | Height: | Size: 407 B |
BIN
ios/app/img/TrackingLocationMask@2x.png
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
ios/app/img/TrackingLocationMask@3x.png
Normal file
|
After Width: | Height: | Size: 903 B |
BIN
ios/app/img/TrackingLocationOffMask.png
Normal file
|
After Width: | Height: | Size: 493 B |
BIN
ios/app/img/TrackingLocationOffMask@2x.png
Normal file
|
After Width: | Height: | Size: 973 B |
BIN
ios/app/img/TrackingLocationOffMask@3x.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 521 B |