最近做项目的时候遇到屏幕边缘卡死的问题
于是把解决的方式记录下来
供遇到问题的朋友参考
发现问题麻烦私聊我
- 遵循手势的代理
UIGestureRecognizerDelegate
- 此处用到的协议方法
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer {
return self.isCanSideBack;
}
- 禁用边缘返回 关闭ios右滑返回
-(void)forbiddenSideBack{
self.isCanSideBack=NO;
//关闭ios右滑返回
if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate=self;
}
}
- 恢复边缘返回
- (void)resetSideBack {
self.isCanSideBack=YES;
//开启ios右滑返回
if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- 上面两个方法的调用
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self forbiddenSideBack];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self resetSideBack];
}