【发布时间】:2016-11-24 14:41:05
【问题描述】:
我有一个自定义导航控制器声明如下。我的问题是,一旦我实现了这个,返回到上一个堆栈的向后滑动手势(interactivepopgesturerecognizer)就不起作用了。如何重新启用它?我的应用程序中有很多视图控制器。谢谢。
#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
【问题讨论】:
标签: ios uinavigationcontroller uigesturerecognizer