如何隐藏在UIViewController中最上面一栏时,我使用pushViewController的导航控制器推? 任何帮助吗?
Answer 1:
将此代码放在你要隐藏的导航栏视图控制器。
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
}
你可能还需要在坚持这里面,根据您的需要:
- (void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
Answer 2:
以下是如何做到这一点的斯威夫特3:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
PS我发现,如果你设置的动画到false
,黑条出现在推。 但是,当它被设置为true
它的光滑如丝!
Answer 3:
对于iOS 5月8日是这项工作各地可以工作了
CATransition* transition = [CATransition animation];
transition.duration = 0.3;
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[self.navigationController setNavigationBarHidden:TRUE animated:FALSE];
[self.navigationController pushViewController:productViewObj animated:FALSE];
[productViewObj.navigationController setNavigationBarHidden:TRUE animated:FALSE];
[productViewObj release];
文章来源: how to hide navigationbar when i push from navigation controller?