Browse Source

Fix bug with navbar tap gesture

Tap gesture in FLEXNavigationController's navigation bar causes buttons to reportedly become unresponsive on iOS 11 and 12 unless `cancelsTouchesInView` is turned off
Alexey Salangin 3 years ago
parent
commit
bf42bbe27b
1 changed files with 6 additions and 3 deletions
  1. 6 3
      Classes/Core/Controllers/FLEXNavigationController.m

+ 6 - 3
Classes/Core/Controllers/FLEXNavigationController.m

@@ -36,10 +36,13 @@
     self.waitingToAddTab = YES;
     
     // Add gesture to reveal toolbar if hidden
-    self.navigationBar.userInteractionEnabled = YES;
-    [self.navigationBar addGestureRecognizer:[[UITapGestureRecognizer alloc]
+    UITapGestureRecognizer *navbarTapGesture = [[UITapGestureRecognizer alloc]
         initWithTarget:self action:@selector(handleNavigationBarTap:)
-    ]];
+    ];
+    
+    // Don't cancel touches to work around bug on versions of iOS prior to 13
+    navbarTapGesture.cancelsTouchesInView = NO;
+    [self.navigationBar addGestureRecognizer:navbarTapGesture];
     
     // Add gesture to dismiss if not presented with a sheet style
     if (@available(iOS 13, *)) {