Instance Property

parentViewController

The parent view controller of the recipient.

Declaration

@property(nonatomic, weak, readonly) UIViewController *parentViewController;

Discussion

If the recipient is a child of a container view controller, this property holds the view controller it is contained in. If the recipient has no parent, the value in this property is nil.

Prior to iOS 5.0, if a view did not have a parent view controller and was being presented, the presenting view controller would be returned. On iOS 5, this behavior no longer occurs. Instead, use the presentingViewController property to access the presenting view controller.

See Also

Getting Other Related View Controllers

presentingViewController

The view controller that presented this view controller.

presentedViewController

The view controller that is presented by this view controller, or one of its ancestors in the view controller hierarchy.

splitViewController

The nearest ancestor in the view controller hierarchy that is a split view controller.

navigationController

The nearest ancestor in the view controller hierarchy that is a navigation controller.

tabBarController

The nearest ancestor in the view controller hierarchy that is a tab bar controller.