はい、キャンセルボタンとタイトルの両方をナビゲーションバーの上部に追加できます。
ナビゲーションコントローラにビューコントローラを組み込み、storyboadIdをナビゲーションコントローラに追加します。そして、あなたはボタンアクションの使用この
をこのコード
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithTitle:@"Flip"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(cancelButtonAction:)];
self.navigationItem.rightBarButtonItem = flipButton;
self.navigationItem.title = @"Wishlist";
を追加)(のviewDidLoadで、ご希望のクラスでは、あなたがVC
を
UINavigationController *initialNavigationController = (UINavigationController*)[self.storyboard instantiateViewControllerWithIdentifier:@"HomeNavCtrl_id"];
[self presentViewController:initialNavigationController animated:YES completion:nil];
希望提示のためにキャンセルしたいから、どのクラスにコードを追加します。
- (IBAction)cancelBtnAction:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
ここでは何をしたいのですか? – KKRocks
ナビゲーションバーの左側にキャンセルテキストを表示できません – Secondwave
キャンセルボタンを追加するにはどうすればよいですか? – KKRocks