viewDidLoad 内にあるカスタム UIBarButton を作成できるこのコードがあります。
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleDone
target:nil
action:nil];
self.navigationItem.rightBarButtonItem = doneButton;
ここで、UIBarButton が押されたときに以下のこのメソッドを呼び出して、次のビュー コントローラーへのセグエが実行されるようにします。
- (void) didPressDone {
PointsResultsViewController *pointsResults = [self.storyboard instantiateViewControllerWithIdentifier:@"resultsPointsVC"];
[self.navigationController pushViewController:pointsResults animated:YES];
}
私はこれについていくつかの調査を行いました。しかし、私が見たものはすべて、UIBarButton をオブジェクト ライブラリから ViewController にドラッグし、それを次の VC に接続するだけでした。私の場合はかなり違います。
アドバイスをください:)