我有一个通过情节提要segue推动UITableView
一个视图,该视图显示一个UILabel
我希望相indexPath.row
对于.UITableView
我知道这可能大错特错,但这是我的尝试。我觉得我做错了:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"ArticlePreviewSegue" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = [sender indexPathForSelectedRow];
ArticlePreviewViewController *apvc = [segue destinationViewController];
NSDictionary *article = [_newsFetcher.articles objectAtIndex:indexPath.row];
apvc.titleLabel.text = [article objectForKey:@"title"];
apvc.bodyLabel.text = [article objectForKey:@"body"];
}
谢谢!