自定义返回按钮,系统的滑动返回失效的解决办法
作者:
Demonboy | 来源:发表于
2017-07-04 11:54 被阅读14次1. 在自定义的NavigationController
- (void)viewDidLoad {
[super viewDidLoad];
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.interactivePopGestureRecognizer.delegate = (id)self;
}
}
2. 在pushViewController方法重写
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.childViewControllers.count > 0) {//非根控制器
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.interactivePopGestureRecognizer.enabled = YES;
}
viewController.hidesBottomBarWhenPushed = YES;
}
//真正在跳
[super pushViewController:viewController animated:animated];
}
本文标题:自定义返回按钮,系统的滑动返回失效的解决办法
本文链接:https://www.haomeiwen.com/subject/omgthxtx.html
网友评论