今天測試提了個(gè)bug,說是我的頁面偶現(xiàn)點(diǎn)擊push的時(shí)候頁面卡死
經(jīng)過定位,發(fā)現(xiàn)這實(shí)際上是根控制器與側(cè)滑手勢interactivePopGestureRecognizer的沖突導(dǎo)致的問題。
當(dāng)頁面在根控制器內(nèi)的時(shí)候需要禁用掉側(cè)滑手勢
我們是自定義的導(dǎo)航控制器,在自定義的導(dǎo)航控制器里面添加對(duì)應(yīng)的導(dǎo)航代理方法
- (void)viewDidLoad {
[super viewDidLoad];
self.interactivePopGestureRecognizer.delegate = self;
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (navigationController.viewControllers.count > 1) {
self.interactivePopGestureRecognizer.enabled = YES;
} else {
self.interactivePopGestureRecognizer.enabled = NO;
}
}