标签:
在开发过程中,经常会用到,需要关闭某个页面的手势返回功能。
// 禁用返回手势 - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // 禁用 返回手势 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = NO; } } // 开启手势 - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // 开启手势 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; } } // 导航栏返回 - (void)blackBtnClick { // 开启手势,有时只在(void)viewWillDisappear:(BOOL)animated开启,该根栏目下所有的手势都会失效 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; } [self.navigationController popToRootViewControllerAnimated:YES]; }
参考网站:http://blog.csdn.net/jasonblog/article/details/28282147
标签:
原文地址:http://www.cnblogs.com/jys509/p/5060327.html