Disable swipe back gesture in Swift

后端 未结 10 1477
轻奢々
轻奢々 2020-12-02 09:47

Been looking around on here for a while but can\'t seem to find a working solution.

I\'m trying to disable the swipe to go back to previous view gesture, in Swift.

10条回答
  •  遥遥无期
    2020-12-02 10:11

    You could disable it but that would not be to recommended as most iOS users go back by swiping and less by pressing the back button. If you want to disable it it would be more reasonable to use a modal segue instead of a push segue which is not that big of a transfer. If you really want to get rid of the swipe to go back function I would just disable the back button and have a done button on the top right of the screen.

    self.navigationController?.navigationItem.backBarButtonItem?.isEnabled = false;
    

提交回复
热议问题