0

用数据从 TableView 初始化 DetailView 的最佳方法是什么?

我需要“发送”一个对象来填充所有标签和 ImageView。

我更改视图的代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"detailView"] animated:true];
}

迈克

4

2 回答 2

1
DetailViewController *viewController = (DetailViewController*) [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
viewController.myProperty1 = object1;
viewController.myProperty2 = object2;
[self.navigationController pushViewController:viewController animated:YES];
于 2012-09-03T13:10:46.880 回答
0

只需从情节提要中实例化 ViewController 并在推送 ViewController 之前对其进行设置

YourViewControllerclass * vc = (YourViewControllerclass*) [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
[vc setupMethodForObject: object];
[self.navigationController pushViewController:vc animated:YES];
于 2012-09-03T13:04:32.903 回答