UinavigationControllerはモーダルビューコントローラを表示していません
-
21-12-2019 - |
質問
メインビューコントローラのボタンを押すと、プログラムでモーダルビューコントローラが表示されています。私が持っている問題は、モーダルビューがナビゲーションバーなしで表示されることです。
バーをどのように表示させることができますか?私のコードを見つけて、何が足りないか間違っているのか教えてください:
-(void)appInfoButtonPressed:(id)sender {
infoViewController *iVC=[[infoViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:iVC animated:YES completion:nil];
UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:iVC];
[self presentViewController:navBar animated:YES completion:nil];
.
}
も試みてモーダルビューを解除しているのは、以下の行を使用することを意図しています。
[self dismissViewControllerAnimated:YES completion:nil];
.
メインビューコントローラのメソッドまたはモーダルビューコントローラ自体の方法でこの行を含めるべきですか?
解決
削除[Self PresentViewController:IVC Animated:はい完了:nil]; UinavigationControllerを提示するのにのみ
「NAVBAR」を使用してUinavigationControllerに名前を付けることは適していません。
-(void)appInfoButtonPressed:(id)sender {
infoViewController *iVC=[[infoViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:iVC];
[self presentViewController:navController animated:YES completion:nil];
}
. 所属していません StackOverflow