Push different views from a table.
- by Tanner
Hello All,
Ive been following a tutorial to implement a search bar ( http://www.iphonesdkarticles.com/2009/01/uitableview-searching-table-view.html ) However I cant seem to push different views. Here is what my didsSelectRowAtIndexPath looks like.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedCountry = nil;
if(searching)
selectedCountry = [copyListOfItems objectAtIndex:indexPath.row];
else {
NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Countries"];
selectedCountry = [array objectAtIndex:indexPath.row];
}
//Initialize the detail view controller and display it.
if ([[listOfItems objectAtIndex:indexPath.row] isEqual:@"neon"]){
Neon *abo = [[Neon alloc] initWithNibName:@"Neon" bundle:nil];
//dvController.selectedCountry = selectedCountry;
[self.navigationController pushViewController:abo animated:YES];
[abo release];
}
}
And here is the debuger message when I click on neon:
2010-05-09 08:47:27.516 iTeachU[3821:307] * Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSMutableArray objectAtIndex:]: index 60 beyond bounds [0 .. 0]'
** Call stack at first throw:
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
If anyone has a way to push views based on the cells text it would be greatly appreciated. Thanks