summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2018-02-07 16:53:33 -0500
committerJason Wray <jason@mapbox.com>2018-02-07 16:53:33 -0500
commit511fca7210f8b41c37a2250e77239e4b25b41ed5 (patch)
treebe8e740e72c7841993bbd78ff1b4cb09eeed3cc3 /platform
parent6e171a62a9cc07ddbb0765e3021e46ebd60313df (diff)
downloadqtlocation-mapboxgl-511fca7210f8b41c37a2250e77239e4b25b41ed5.tar.gz
[ios] Add fall-through single tap to iosapp
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/app/MBXViewController.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 259c1191bc..02652b5490 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -271,6 +271,16 @@ CLLocationCoordinate2D randomWorldCoordinate() {
[self presentViewController:alertController animated:YES completion:nil];
}
+
+ // Add fall-through single tap gesture recognizer. This will be called when
+ // the map view's tap recognizers fail.
+ UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
+ for (UIGestureRecognizer *gesture in self.mapView.gestureRecognizers) {
+ if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
+ [singleTap requireGestureRecognizerToFail:gesture];
+ }
+ }
+ [self.mapView addGestureRecognizer:singleTap];
}
- (void)saveState:(__unused NSNotification *)notification
@@ -1830,6 +1840,14 @@ CLLocationCoordinate2D randomWorldCoordinate() {
#pragma mark - User Actions
+- (void)handleSingleTap:(UITapGestureRecognizer *)singleTap {
+ [self.navigationController setNavigationBarHidden:!self.navigationController.navigationBarHidden animated:YES];
+
+ // This is how you'd get the coordinate for the point where the user tapped:
+ // CGPoint tapPoint = [singleTap locationInView:self.mapView];
+ // CLLocationCoordinate2D tapCoordinate = [self.mapView convertPoint:tapPoint toCoordinateFromView:nil];
+}
+
- (IBAction)handleLongPress:(UILongPressGestureRecognizer *)longPress
{
if (longPress.state == UIGestureRecognizerStateBegan)