comment masquer la barre de navigation quand je pousse depuis le contrôleur de navigation?
-
06-07-2019 - |
Question
comment masquer la barre supérieure dans UIViewcontroller lorsque j'appuie sur le contrôleur de navigation à l'aide de pushViewController ? toute aide s'il vous plaît?
La solution
Placez ce code dans le contrôleur de vue pour lequel vous souhaitez masquer la barre de navigation.
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
}
Et vous voudrez peut-être aussi y coller, en fonction de vos besoins:
- (void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
Autres conseils
Voici comment procéder dans Swift 3 :
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
P.S. J'ai constaté que si vous définissez animé sur false
, une barre noire apparaît lors de l'envoi. Mais quand il est réglé sur true
, tout est lisse comme de la soie!
Pour iOS 8 Peut-être ce travail autour pourrait-il fonctionner
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];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow