Hi All
I am working off a customized version of
iPhone – Core Data and UITableView. A drill-down application
I want to delete the 'province' drop down and go strait to city.
I don't have a third tier of navigation in my app.
Here's the code I THINK I need to modify
Code:
// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(self.entityName == @"County" || self.entityName == @"Province")
{
// Get the object the user selected from the array
NSManagedObject *selectedObject = [entityArray objectAtIndex:indexPath.row];
// Create a new table view of this very same class.
RootViewController *rootViewController = [[RootViewController alloc]
initWithStyle:UITableViewStylePlain];
// Pass the managed object context
rootViewController.managedObjectContext = self.managedObjectContext;
NSPredicate *predicate = nil;
if(self.entityName == @"County")
{
rootViewController.entityName = @"Province";
// Create a query predicate to find all child objects of the selected object.
predicate = [NSPredicate predicateWithFormat:@"(ProvinceToCounty == %@)", selectedObject];
}
else if(self.entityName == @"Province")
{
rootViewController.entityName = @"City";
// Create a query predicate to find all child objects of the selected object.
predicate = [NSPredicate predicateWithFormat:@"(CityToProvince == %@)", selectedObject];
}
[rootViewController setEntitySearchPredicate:predicate];
//Push the new table view on the stack
[self.navigationController pushViewController:rootViewController animated:YES];
[rootViewController release];
}
if(self.entityName == @"City")
{
// Get the object the user selected from the array
City *selectedCity = [entityArray objectAtIndex:indexPath.row];
DetailsViewController *detailsView = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:[NSBundle mainBundle]];
detailsView.title = selectedCity.Name;
detailsView.inhabitants = selectedCity.Inhabitants;
detailsView.description = selectedCity.Description;
detailsView.phone = selectedCity.Phone;
detailsView.email = selectedCity.Email;
//Push the new table view on the stack
[self.navigationController pushViewController:detailsView animated:YES];
[detailsView release];
}
}
I want to go strait from the 'country' view to the 'city' view with the detailsView controller.
How the heck do I do that?