I am trying to get the trail name from the selected cell and pass it on to the next view in didSelectRowAtIndexPath. How would I go about this? http://pastebin.com/bgXNfjie
A:
hi there, if I understood you correctly, then this is not such a big thing. You just have to make a property in TrailViewController to hold your value and assign it like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
TrailViewController *trailViewController = [[TrailViewController alloc] initWithNibName:@"TrailViewController" bundle:[NSBundle mainBundle]];
NSDictionary *dict = [rows objectAtIndex: indexPath.row];
trailViewController.trailName = [dict objectForKey:@"name"];
[self.navigationController pushViewController:trailViewController animated:YES];
[trailViewController release];
}
Instead of just the name, you'll probably want to assign the complete NSDictionary to a property of the TrailViewController,but thats up to you. I hope I could help...
dreipol
2010-08-08 18:26:24