简体   繁体   中英

ViewController Interactive transition pan gesture recognizer

I'm trying to add interactive transition to modal presentation of my view controller. I add pangesturerecognize to detect user's touches and move the view. I have just read a lot of articles about custom transitions and in every article authors call dismiss method in the beginning:

func handleGesture(_ gestureRecognizer: UIScreenEdgePanGestureRecognizer)
    switch gestureRecognizer.state {
    case .began:
      interactionInProgress = true
      viewController.dismiss(animated: true, completion: nil)
      ...
}

I've tried to remove this method and this still working. Can someone explain why we need to call dismiss(animated: true, completion: nil) in the beginning of handling gestures?

It doesn't make any sense for Gesture.Maybe the articles you read are from one author or maybe they copied the same source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM