我正在尝试从所选单元格中获取跟踪名称,并将其传递给didSelectRowAtIndexPath中的下一个视图。我该怎么做? http://pastebin.com/bgXNfjie
答案 0 :(得分:1)
- (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];
}
您可能希望将完整的NSDictionary分配给TrailViewController的属性,而不仅仅是名称,但这取决于您。我希望我能帮忙......