0

我正在使用 iOS 5 和 Xcode 4 的故事板并遇到了一个小问题。我有一个视图控制器(WallPostViewController),它是我的导航控制器的根视图控制器。通过情节提要,我有一个 segue(称为“PushWallPostCommentsSegue”),它在用户单击按钮后执行。当我到达时prepareForSegue:sender,我在新推送的视图控制器中设置了一个对象。

代码如下:

-(IBAction)addNewCommentButtonTouched:(id)sender {

    [self performSegueWithIdentifier:@"PushWallPostCommentsSegue" sender:self];    
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([segue.identifier isEqual:@"PushWallPostCommentsSegue"]) {
        NSLog(@"Pushing from %@ to %@", segue.sourceViewController, segue.destinationViewController);


        WallPostCommentsViewController* wallPostCommentsViewController = segue.destinationViewController;
        [wallPostCommentsViewController setWallPost:wallPostInfo];
        [wallPostCommentsViewController setParent:self];
    }

}

问题是:这个视图控制器永远不会被推送并被自动释放(即使它在情节提要中有连接并且它拥有其他对象)。顺便说一句,这个视图控制器的initWithCoder:方法被调用了。

只是在这里找不到问题。有什么注意的吗?

在此先感谢,里卡多 P。

4

0 回答 0