我想使用Storyboard中的segue(ShowADVDetail)将数据从TableViewController单元传递到DetailViewContoller(UITableViewController)。将数据传递给另一个Segue的问题DetailTableViewController
我有一个NSMutableArray'故事'包含解析的RSS提要。
我使用以下prepareForSegue,其经过的小区的“标题”值:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ShowADVDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
NSString *theTitle = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];
[[segue destinationViewController] setDetailItem:theTitle];
}
}
随着下面的行我可以通过特定的细胞的“标题”的值。
NSString *theTitle = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];
我还可以访问像这样的“说明”的价值和“链接”值:
NSString *theDescription = [[stories objectAtIndex: storyIndex] objectForKey: @"description"];
NSString *theLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"];
但我怎么能传递我赛格瑞所有3个值?
我didSelectRowAtIndexPath方法到目前为止是这样的:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO]
[self performSegueWithIdentifier:@"ShowADVDetail" sender:self];
}
希望这有意义..
感谢
大的检查。这有帮助。 – user1297842 2012-04-10 02:16:23