How do I pass between objects from uitableviews to my detail views? I've set up a conditional push, as you can see in my method:
-(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?
}
}
I'm having trouble with the UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:targetViewControllerIdentifier];
Usually, I just set vc.budget = tempbudget as the answer below suggests, but it does not seem to understand the budget property.