昨天发现ios8系统右滑不能关掉,关于系统的方法
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
在ios8上的各个生命周期中调用这个方法都不生效,ios7 是可以的,这个应该是ios8的bug。查遍了stackoverflow,试遍了各种方案都不可靠,最后剑走偏锋,只能通过终端手势事件的传递链来解决如下:
添加手势终端滑动手势的传递
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(doNothing:)];
[self.view addGestureRecognizer:pan];
在响应事件中判断不同的recognizer来处理自己的逻辑。
-(void)doNothing:(UISwipeGestureRecognizer *)recognizer{
}