コードでモーダル ビュー コントローラーを起動しており、データ オブジェクトを渡したいと考えています。オブジェクトの宛先 VC にプロパティを作成しました。新しい VC は正常に起動していますが、データ オブジェクトを取得していません。次のコードに何か問題がありますか? そうでない場合は、別の場所でエラーを探す必要がありますが、これがデータ オブジェクトを渡す正しい方法であるかどうか疑問に思っています。
//in header file of destination VC
@property (nonatomic, strong) Product *product;
//in .m file of starting VC
- (void) gotoStoryboard {
UIStoryboard *storyBoard = self.storyboard;
moreInfoVC *infoVC =
[storyBoard instantiateViewControllerWithIdentifier:@"moreInfo"];
infoVC.product = _product;//IS THIS ADEQUATE TO PASS DATA OBJECT?
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: infoVC];
[self presentModalViewController:nav animated:YES];
}