Accessing parentviewcontroller
===

I have a cancel button, when i press cancel button then i pop my current viewcontroller. Before popping my controller, i want to access one member (which is a class Student) of previous view controller. So i am doing this way:

    StudentProfileViewController *controller = (StudentProfileViewController*)self.parentViewController;
        NSLog(@"%@", controller.student);

My app crashes on line NSLog, error is this:

    [UINavigationController student]: unrecognized selector sent to instance 0x6865180

Strange part is its says "[UINavigationController student]" but my controller is UIViewController.

Can anyone shed a light on this. I know some silly mistake is being done.

Thanks