Merge pull request #1239 from friedbunny/locate-button

Add simple tracking mode button to demo app
This commit is contained in:
Minh Nguyễn
2015-04-09 09:56:01 -07:00
13 changed files with 24 additions and 1 deletions

View File

@@ -91,7 +91,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)];
@@ -304,6 +304,29 @@ 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;
}
[UIView animateWithDuration:0.25 animations:^{
self.navigationItem.rightBarButtonItem.image = newButtonImage;
}];
}
#pragma clang diagnostic pop
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B