我在代碼中啓動模態視圖控制器,並希望傳遞數據對象。我已經在對象的目標VC上創建了一個屬性。新的VC正在啓動,但沒有獲取數據對象。下面的代碼有什麼問題嗎?如果沒有,我將不得不在其他地方尋找錯誤,但是想知道這是否是傳遞數據對象的正確方法。iOS/objective-c:將對象傳遞到新的視圖控制器
//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];
}