In a ViewController
of my iOS app I wish to override the swipe back action depending on a condition. Specifically, if a condition is met, the swipe back gesture must perform a custom action, otherwise it must perform the default action - some kind of super
method. There are many related questions on the site, but I could not find anything related to such a super
-like method.
Asked
Active
Viewed 153 times
0

MathMax
- 571
- 7
- 22
-
1https://stackoverflow.com/questions/34942571/how-to-enable-back-left-swipe-gesture-in-uinavigationcontroller-after-setting-le It seems that you can intercept the swipe back, decide and decide what to do according to your condition. – Larme Oct 28 '20 at 14:35
-
@Larme thank you, but once I intercept the gesture, how do I tell the `UIView` that it should perform the default swipe back action? – MathMax Oct 28 '20 at 14:46
-
2The back is a pop. So call `[self popViewControllerAnimated:YES]` https://developer.apple.com/documentation/uikit/uinavigationcontroller/1621886-popviewcontroller – Larme Oct 28 '20 at 14:48