[英]Enable back back swipe gesture when using custom navigation controller
I've got a custom navigation controller declared as below. 我有一个自定义的导航控制器声明如下。 My problem is that once I implement this, the back swipe gesture to go back to previous stack (interactivepopgesturerecognizer) is not working. 我的问题是,一旦实现此功能,向后滑动手势就无法返回到先前的堆栈(interactivepopgesturerecognizer)。 How can I enable it back? 如何重新启用? I've got a lot of view controller in my app. 我的应用程序中有很多视图控制器。 Thank You. 谢谢。
#import "NavController.h"
@interface NavController ()
{
BOOL shouldIgnorePushingViewControllers;
}
@end
@implementation NavController
-(instancetype)init {
self = [super init];
self.delegate=self;
return self;
}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (!shouldIgnorePushingViewControllers)
{
[super pushViewController:viewController animated:animated];
}
shouldIgnorePushingViewControllers = YES;
}
- (void)didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
shouldIgnorePushingViewControllers = NO;
}
@end
Try to enable property 尝试启用属性
self.interactivePopGestureRecognizer.enabled = YES;
to init
method init
方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.