The pop-up viewing controller using the screen gesture recognition device does not follow the edge of the screen with the thumb

As soon as I added the navigation bar item to the navigation bar, I lost the ability to use the default function to return. I would like to be able to use the "swipe along the edge" to go back.

I added the Edge Pan edge recognition flag and connected it to @IBAction, but the deviation action takes place completely as soon as the panorama gesture is recognized.

Instead of slowly following my thumb (as seen from other applications), the current view moves with a predefined animation.

How do I make animations after my thumb using the Edge Pan gesture recognizer?

@IBAction func edgeSwipe(sender: AnyObject) { navigationController?.popViewControllerAnimated(true) } 

enter image description here

+7
cocoa-touch swift uigesturerecognizer uinavigationcontroller
source share
1 answer

There is no need to add an edge pan recognition feature. Following @beyowulf's recommendations, I was able to implement swipes to go back, which behaves the same as with the default implementation - the edge of the views follows the thumb when I scroll it to reject it.

So, I removed the ScreenEdge Pan Gesture Recogniser from the storyboard, and also removed the associated @IBAction .

I made my first view controller a delegate for interactivePopGestureRecognizer . Here is the code:

 class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() navigationController?.interactivePopGestureRecognizer?.delegate = self } } extension ViewController: UIGestureRecognizerDelegate { func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool { return navigationController?.viewControllers.count > 1 ? true : false } } 
+6
source share

All Articles