Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Added UI for course tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Aug 14, 2015
1 parent dfeb479 commit 20ad0d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ios/app/MBXViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ - (void)locateUser
nextMode = MGLUserTrackingModeFollowWithHeading;
break;
case MGLUserTrackingModeFollowWithHeading:
nextMode = MGLUserTrackingModeFollowWithCourse;
break;
case MGLUserTrackingModeFollowWithCourse:
nextMode = MGLUserTrackingModeNone;
break;
Expand Down Expand Up @@ -404,6 +406,7 @@ - (UIColor *)mapView:(__unused MGLMapView *)mapView fillColorForPolygonAnnotatio
- (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(__unused BOOL)animated
{
UIImage *newButtonImage;
NSString *newButtonTitle;

switch (mode) {
case MGLUserTrackingModeNone:
Expand All @@ -415,11 +418,15 @@ - (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUse
break;

case MGLUserTrackingModeFollowWithHeading:
case MGLUserTrackingModeFollowWithCourse:
newButtonImage = [UIImage imageNamed:@"TrackingHeadingMask.png"];
break;
case MGLUserTrackingModeFollowWithCourse:
newButtonImage = nil;
newButtonTitle = @"Course";
break;
}

self.navigationItem.rightBarButtonItem.title = newButtonTitle;
[UIView animateWithDuration:0.25 animations:^{
self.navigationItem.rightBarButtonItem.image = newButtonImage;
}];
Expand Down

0 comments on commit 20ad0d5

Please sign in to comment.