問題:當(dāng)我們隱藏UINavigationController會(huì)發(fā)現(xiàn),我們的側(cè)滑返回就沒有響應(yīng)了.
解決問題:
首先我們新建一個(gè)BaseNavigationViewController繼承UINavigationController.
用來作為我們的navigationController
BaseNavigationViewController.m中
@interface BaseNavigationViewController ()<UINavigationControllerDelegate>
@end
@implementation BaseNavigationViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.delegate = self;
self.interactivePopGestureRecognizer.delegate = (id)self.interactivePopGestureRecognizer;
}
// 當(dāng)控制器顯示完畢的時(shí)候調(diào)用
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
//這里是為了防止在跟視圖上側(cè)滑出現(xiàn)的bug(具體什么原因也不知道);
if (navigationController.viewControllers.count == 1) {
self.interactivePopGestureRecognizer.enabled = NO;
}else{
self.interactivePopGestureRecognizer.enabled = YES;
}
}
到這基本就差不多了