解决方法: app一级页面,大家都知道再返回是没有任何相关的页面,由于这个原因造成页面卡死,所以现在在一级页面分别添加禁用和开启右滑返回手势。
/在一级界面显示出来后取消右滑手势/
-
(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];[self cancelSideBack];
}
/在一级界面消失后开启右滑手势/ -
(void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];[self startSideBack];
}
/** * 关闭ios右滑返回 */
-
(void)cancelSideBack
{
self.isCanUseSideBack = NO;if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate=(id)self;
}
}
/* 开启ios右滑返回 */
-
(void)startSideBack
{
self.isCanUseSideBack=YES;if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
/当在第一级界面右滑时会返回yes,因为可能你已经push过了然后又pop回来,以至于右滑被关闭,所以需要设置为yes/
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer {
return self.isCanUseSideBack;
}