Conditional Segue from UITableView to DetailView depending on object state
I set up the Xcode storyboard of my expanded table to fork out to two detail views.
I want it to navigate to one of them based on the status of the budget object that I used in the table view. If the budget object has not been initialized, I want to go to the initialization view. If it has been initialized, I want it to go to the verbose view.
So far, this is what I have ...
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
/*
When a row is selected, the segue creates the detail view controller as the destination.
Set the detail view controller detail item to the item associated with the selected row.
*/
if ([[segue identifier] isEqualToString:@"showDetailsOfBudget"])
{
NSIndexPath *indexPath = [self.budgetsTable indexPathForSelectedRow];
BudgetDetailsViewController *detailsViewController = [segue destinationViewController];
detailsViewController.budget = [self.budgetPlan.budgets objectAtIndex:indexPath.row];
}
}
Of course, this only forces him to go to the detailed view. I want it to use the "initializeBudget" segue when the case is budget.initialized = false
How to implement a method performSegue:withIdentifier:
for this?
+3
source to share
1 answer