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

Commit

Permalink
Add toggle in iosapp for custom user location annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Aug 16, 2016
1 parent 412214d commit 634f680
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions platform/ios/app/MBXViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ @interface MBXViewController () <UIActionSheetDelegate, MGLMapViewDelegate>
@property (nonatomic) IBOutlet MGLMapView *mapView;
@property (nonatomic) NSInteger styleIndex;
@property (nonatomic) BOOL debugLoggingEnabled;
@property (nonatomic) BOOL customUserLocationAnnnotationEnabled;

@end

Expand Down Expand Up @@ -202,7 +203,10 @@ - (IBAction)showSettings:(__unused id)sender
@"Start World Tour",
@"Add Custom Callout Point",
@"Remove Annotations",
@"Runtime styling",
@"Runtime Styling",
((_customUserLocationAnnnotationEnabled)
? @"Disable Custom User Dot"
: @"Enable Custom User Dot"),
nil];

if (self.debugLoggingEnabled)
Expand Down Expand Up @@ -284,6 +288,12 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn
{
[self testRuntimeStyling];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 17)
{
_customUserLocationAnnnotationEnabled = !_customUserLocationAnnnotationEnabled;
self.mapView.showsUserLocation = NO;
self.mapView.userTrackingMode = MGLUserTrackingModeFollow;
}
else if (buttonIndex == actionSheet.numberOfButtons - 2 && self.debugLoggingEnabled)
{
NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogfilePath] encoding:NSUTF8StringEncoding error:nil];
Expand Down Expand Up @@ -702,9 +712,13 @@ - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAn
{
if (annotation == mapView.userLocation)
{
//MBXUserLocationAnnotationView *annotationView = [[MBXUserLocationAnnotationView alloc] initWithFrame:CGRectZero];
//annotationView.frame = CGRectMake(0, 0, annotationView.intrinsicContentSize.width, annotationView.intrinsicContentSize.height);
//return annotationView;
if (_customUserLocationAnnnotationEnabled)
{
MBXUserLocationAnnotationView *annotationView = [[MBXUserLocationAnnotationView alloc] initWithFrame:CGRectZero];
annotationView.frame = CGRectMake(0, 0, annotationView.intrinsicContentSize.width, annotationView.intrinsicContentSize.height);
return annotationView;
}

return nil;
}
// Use GL backed pins for dropped pin annotations
Expand Down

0 comments on commit 634f680

Please sign in to comment.