[iOS]使用侧滑手势卡死问题
2018-06-13 本文已影响0人
Daniel_you
有时候需求是一个页面不可以使用侧滑手势,下一个页面使用侧滑手势.我们只需要在不使用侧滑手势的页面写如下代码
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
-(void)viewWillDisappear:(BOOL)animated {
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
[super viewWillDisappear:animated];
}
切记:注意viewWillDisappear里边的代码.要不然Push到下个页面使用侧滑手势会卡死界面