如何将对象从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