开发者

Use dictionary with didSelectRowAtIndexPath

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


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜