pop手势

需求:A控制器是我push过来的,我希望这个控制器只能点击导航条左边的返回按钮来pop,而侧边右滑动的手势pop我希望能把它禁用掉。当然其他控制器我希望不还是有这个pop的手势

在 A 控制器里写:

- (void)viewWillAppear:(BOOL)animated{   

 [superviewWillAppear:animated];

self.navigationController.interactivePopGestureRecognizer.delegate=self;

}

- (void)viewWillDisappear:(BOOL)animated{   

 [superviewWillDisappear:animated];

self.navigationController.interactivePopGestureRecognizer.delegate=nil;

}

// 给该控制器添加协议 - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{

returngestureRecognizer !=self.navigationController.interactivePopGestureRecognizer;

}

你可能感兴趣的:(pop手势)