Is there a way to get a notification automatically if a view controller is presented modally on top of another view controller (except viewWillDisappear, which is obviously not intended for a non-full-screen modal view on an iPad)?
Background / use case: in the application for iPad every time a text sheet of the form is submitted, I want to customize the appearance of the view behind the modal. However, a presentation, if modalities are not necessarily done in the same view controller, which needs to be adapted, but rather can happen in some child or parent VCs. Of course, I could just report this event manually (via notification, delegation, or something else), but this is quite repetitive and can be easily forgotten when additional formal forms are added in the future.
So, I wonder if there is an even more elegant way to achieve this. I tried KVO on presentedViewController, but that doesn't seem to work (and I'm also not sure if it will presentedViewControllerreally be set if the modal view is executed by the child view controller ...).
source
share