Is it possible to check inside ViewController class that it is presented as modal view controller?
A hack like this might work.
UIViewController* child = self;
UIViewController* parent = child.parentViewController;
while (parent && parent.modalViewController != child) {
child = parent;
parent = child.parentViewController;
}
if (parent) {
// A view controller in the hierarchy was presented as a modal view controller
}
However, I think my previous answer is a cleaner solution.