今天測(cè)試提了個(gè)bug,說(shuō)是我的頁(yè)面偶現(xiàn)點(diǎn)擊push的時(shí)候頁(yè)面卡死
經(jīng)過(guò)定位,發(fā)現(xiàn)這實(shí)際上是根控制器與側(cè)滑手勢(shì)interactivePopGestureRecognizer的沖突導(dǎo)致的問(wèn)題。
當(dāng)頁(yè)面在根控制器內(nèi)的時(shí)候需要禁用掉側(cè)滑手勢(shì)
我們是自定義的導(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;
}
}