我有一个已成功用字典数组填充的Uitableview单元格。现在,我很难将选定的单元格值传递给另一个视图控制器并显示该值。
这是我的代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"Tapped: %@",[[feeds objectAtIndex:indexPath.row]objectForKey:@"IncidentNumber"]);
someProperty = [[feeds objectAtIndex:indexPath.row]objectForKey:@"IncidentNumber"];
[self performSegueWithIdentifier:@"item" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([[segue identifier] isEqualToString:@"yourSegue"])
{
DescriptionViewController *vc;
vc = segue.destinationViewController;
vc.item_pass = someProperty;
}
}
您使用标识符项执行segue,但稍后prepareForSegue
再检查使用标识符yourSegue的segue ...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句