Desasignación automática del controlador de vista en push usando storyboard y segue

I am using storyboards with iOS 5 and Xcode 4 and have run into a small problem. I have a view controller (WallPostViewController) that is the root view controller of my navigation controller. Through the storyboard, I have a segue (called "PushWallPostCommentsSegue") which is performed after the user clicks a button. When I get to prepareForSegue:sender, I set an object inside the newly pushed view controller.

El código sigue:

-(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];


The problem is: this view controller is never pushed and is automatically deallocated (even though it has connections in the storyboard and it's own other objects). Btw, this view controller's initWithCoder: method IS called.

Just can't find the problem here. Any heads up?

Thanks in advance, Ricardo P.

preguntado el 31 de enero de 12 a las 16:01

In addNewCommentButtonTouched:, Mira esto self.navigationController no es nulo. -

Bull's eye. I believed that all children of a view controller who is child to a navigation controller could ask for pushes and pops as the parent does. Obviously, I was wrong. Thanks a lot, rob. -

This is most-likely due to the fact that your navigationController es nulo. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.