I have a tab
based application. One of the views
in it is pushing a modal view controller
. If I call self.presentingViewController>
From Apple's documentation:
The default implementation of this property walks up the view hierarchy, starting from this view controller. The first view controller it finds that received the presentViewController:animated:completion: method, or that has its definesPresentationContext property set to YES is returned as the value of the property. It keeps walking up the hierarchy until it finds a value to return or it gets to the root view controller.
So, even though the other view controller pushed it, that view controller's view is covered by the modal view. They walk up the hierarchy until it finds a view controller that doesn't have its view obscured, or has definesPresentationContext
set to YES, or until it reaches the root view controller, which in your case was the Tab Bar Controller.
I would say that the presenting view controller needs to set definesPresentationContext
to YES to answer your question on how to return that view controller that presented the modal one.