简体   繁体   中英

Implement swipe to go back in Swift

Is there an easy solution to enable the function where the user swipes to get back? Couldn't find an easy solution that works for me.

UIKit disables the default back gesture if you use any custom transitions. You can unset the navigationControllerDelegate to get back the back gesture. or implement your own back gesture through interactive transition.

Inside viewDidLoad() of the destination-ViewController following line does the trick:

navigationController?.interactivePopGestureRecognizer?.delegate = nil

Link

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