本文主要是介绍iOS 侧滑手势的打开关闭,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
方法一:
参考文章:点这里
方法二:
- (void)viewWillDisappear:(BOOL)animated{[super viewWillDisappear:animated];[self.navigationController.navigationBar setHidden:NO];//在其他离开改页面的方法同样加上下面两句代码self.isTapBack = YES;if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {self.navigationController.interactivePopGestureRecognizer.delegate = nil;}
}- (void)viewDidAppear:(BOOL)animated {[super viewDidAppear:animated];self.isTapBack = NO;if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;}
}- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer{return self.isTapBack; //YES:允许右滑返回 NO:禁止右滑返回
}
这篇关于iOS 侧滑手势的打开关闭的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!