How to turn off the automatic gesture to go back a view with a navigation controller?

后端 未结 6 1051
清歌不尽
清歌不尽 2020-12-13 06:56

So I\'m noticing all of my views are receiving the gesture to go back (pop a view) when the user swipes on the very left side of the screen (in either orientation) (

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 07:38

    Adding to Gabriele's Solution.

    To support any iOS before iOS 7 you will need to wrap this code with this:

    if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
            self.navigationController.interactivePopGestureRecognizer.enabled = NO;
        }
    

    This will stop the App crashing in iOS 6 and iOS 5 for missing selector.

提交回复
热议问题