在我的视图中,当我向后滑动时,我有一个奇怪的反应。 它没有回到我的上一页,但其他页面没有这个问题。此外,它在滑动后执行上一页viewWillAppear代码。
我没有为视图设置任何自定义后退按钮,但它有不同的效果。
- 编辑 -
在我上一页调用影响页面
ViewControllerA *view = [[ViewControllerA alloc] initWithNibName:@"ViewControllerA" bundle:nil];
[self.navigationController pushViewController:view animated:YES];
在我的影响页面中,我只声明了viewDidLoad函数。
我对其他课程的所有导航都使用上述调用。
通过在导航栏上正常点击后退操作,它将正常返回上一页。
- 编辑2 -
我目前的设置是ViewA> ViewB> ViewC,其中ViewC是发生错误的地方。
在ViewB边缘滑动时,它可以返回到ViewA。 在ViewC边缘滑动时,ViewB中的viewWillAppear被调用,但ViewB未显示。
试着把@kaushal回答
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate; //check UIGestureRecognizerDelegate delegate set properly.
}
在ViewB和ViewC中但没有触发。
- 编辑3 -
我测试了我的其他功能流程,似乎有些人在进入第三个视图时遇到同样的问题,而有些则出现在第四个视图中。
答案 0 :(得分:0)
在ViewDidAppear中:使用以下代码:
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate; //check UIGestureRecognizerDelegate delegate set properly.
}
并检查UIGestureRecognizerDelegate不是零。