I have a tableView.
In each cell i display the following characters A, B, C etc..
When a user clicks on A i need the page to go to the other view that shows another tableView that prints the following text America,
Australia. (This part has been done)
When the user clicks B, The view goes to the other page, but since there are no countries stating with the character B it shows an
empty table.
When the user clicks on C countries Canada and China gets displayed.
What i want to do is, When the user clicked on B and since there aren’t any countries, i don’t want the page to get re-directed to-
another page that shows an empty table.
How should i solve this ?
**** All the Country names are loaded from sqlite
I have added the code as follows, so this is why all my screen get directed to the other view (and B showing an empty tableView)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Countries *viewControllerCountries = [[Countries alloc] initWithNibName:@"Countries" bundle:nil];
[self.navigationController pushViewController:viewControllerCountries animated:YES];
[viewController release];
}
Make a method in your Countries class to allow your parent view controller retrieves the record counts. If the count is 0 then don’t push the view.
P.S. I think something like CountriesViewController is less confusing than Countries.