如何將對象從uitableviews傳遞到我的詳細視圖?我已經設置了一個條件推,你可以在我的方法,請參閱:使用didSelectRowAtIndexPath傳遞對象:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Budget * tempBudget = [self.budgetPlan.budgets objectAtIndex:indexPath.row];
NSString *targetViewControllerIdentifier = nil;
if (tempBudget.hasBeenInitialized != true) {
targetViewControllerIdentifier = @"budgetInitializerView";
UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:targetViewControllerIdentifier];
[self.navigationController pushViewController:vc animated:YES];
// how do I pass the tempBudget to the pushed view?
} else {
targetViewControllerIdentifier = @"budgetDetailsView";
UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:targetViewControllerIdentifier];
[self.navigationController pushViewController:vc animated:YES];
// how do I pass the tempBudget to the pushed view?
}
}
我在與UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:targetViewControllerIdentifier];
麻煩通常情況下,我只設置 vc.budget = tempbudget的答案以下建議,但它似乎並不瞭解預算財產。
燦你詳細說明「似乎不瞭解預算財產」?編譯器警告?崩潰?新視圖上沒有顯示任何內容? – 2012-03-27 18:09:50
新視圖中不顯示任何內容。它似乎沒有通過。 – iggy2012 2012-03-27 20:52:30