无法理解为什么以前的视图打开时没有执行任何按钮操作?
Unable to understand that why previous view open without any button action perform?
我的应用程序中有两个视图,第一个视图中有一个按钮,所以当我单击此按钮时,第二个视图打开
当我水平滑动或滚动时,我的问题出现在第二个视图上,那么为什么第一个视图打开时没有注销过程或后退按钮操作执行?
请有人帮助我
这是将新视图控制器推送到导航堆栈时的默认行为。
您可以通过将 interactivePopGestureRecognizer.enabled 设置为 false
来禁用此行为
你必须推送到第二个视图,
这是 iOS 在 iOS 7.
之后的默认行为
您需要为 iOS 8 添加此代码
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return NO;
}
想了解更多,请关注这个link
希望对您有所帮助!
我的应用程序中有两个视图,第一个视图中有一个按钮,所以当我单击此按钮时,第二个视图打开
当我水平滑动或滚动时,我的问题出现在第二个视图上,那么为什么第一个视图打开时没有注销过程或后退按钮操作执行?
请有人帮助我
这是将新视图控制器推送到导航堆栈时的默认行为。 您可以通过将 interactivePopGestureRecognizer.enabled 设置为 false
来禁用此行为你必须推送到第二个视图, 这是 iOS 在 iOS 7.
之后的默认行为您需要为 iOS 8 添加此代码
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return NO;
}
想了解更多,请关注这个link
希望对您有所帮助!