Push different views from a table.

Posted by Tanner on Stack Overflow See other posts from Stack Overflow or by Tanner
Published on 2010-05-09T13:53:20Z Indexed on 2010/05/09 13:58 UTC
Read the original article Hit count: 427

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk