0
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
        NSLog((@"This is didSelectRowAtIndexPAth"));
        DetailViewController *detailViewController = [[DetailViewController alloc] init];
        detailViewController.myDictionary = [self.placeArray objectAtIndex:[indexPath row]]

// 这个 MyDictionary NSdictionary 是在其他 viewController 中声明的,这里填充了 ..

        NSLog(@"My Dictionary: This is a MasterView one %@",detailViewController.myDictionary);

        UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        detailViewController = [mystoryboard instantiateViewControllerWithIdentifier:@"DetailViewController"];

        //The below NSlog is showing the content , its not null still in next viewcontroller same variable showing null content

        NSLog(@"My Dictionary: This is a MasterView two %@",detailViewController.myDictionary);
        [self performSegueWithIdentifier:@"showDetail" sender:self];

}
4

2 回答 2

0

用于PrepareForSegue此目的

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ DetailViewController * detailViewController = (DetailViewController*)segue.destinationViewController; detailViewController.myDictionary = [self.placeArray objectAtIndex:index]; }

于 2013-11-12T05:11:20.640 回答
0

从确实选择只使用 prepareForSegue 方法(希望您已经使用过。)通过 xib 或以编程方式设置呈现视图控制器选项,然后停止。prepareForSegue 将在使用情节提要时呈现视图时自动调用。

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
DetailViewController *detailViewController = [[DetailViewController alloc] init];
        detailViewController.myDictionary = [self.placeArray objectAtIndex:[indexPath row]];  
}

编辑你 did_select_method 并尝试。

于 2013-11-12T05:29:42.720 回答