一 隱藏系統(tǒng)導(dǎo)航欄
- 1 繼承UINavigationControllerDelegate
- 2 在viewWillAppear中設(shè)置代理
(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.delegate = self;
}
- 3 判斷當(dāng)前要顯示的viewController是不是自己炒考,來設(shè)置導(dǎo)航欄的隱藏與否
// 將要顯示控制器
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
// 判斷要顯示的控制器是否是自己
BOOL target = [viewController isKindOfClass:[self class]];
[self.navigationController target animated:YES];
}
二 添加系統(tǒng)右滑返回手勢(shì)
- 1 繼承UIGestureRecognizerDelegate
- 2 在當(dāng)前要實(shí)現(xiàn)系統(tǒng)右滑返回的控制器中加入 self.navigationController.interactivePopGestureRecognizer.delegate = self 即可
self.navigationController.interactivePopGestureRecognizer.delegate = self;
三 單獨(dú)禁止某個(gè)頁面系統(tǒng)的滑動(dòng)返回功能
id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
[self.view addGestureRecognizer:pan];