In my app I can call a UIViewControle in both mode: Push and ModalDialog.
How can I determine, once the UIViewController is active, if has been called as Push or Modal Dialog ?
This method is called after the UIView that is this UIViewController ’s View property is removed from the display UIView hierarchy. Called after the View has laid out its subviews. Called after the controller’s View is loaded into memory. In iOS 6 and later, this method is never called.
This method is called prior to the removal of the UIView that is this UIViewController ’s View from the display UIView hierarchy. Called before the View lays out its subviews. For UIViewController objects that are part of an app extension, called prior to the View being resized. In iOS 6 and later, this method is never called.
Called before the View lays out its subviews. For UIViewController objects that are part of an app extension, called prior to the View being resized. In iOS 6 and later, this method is never called. In prior versions it was called prior to the controller’s view was released from memory.
A standard UINavigationController for reviewing and editing video and audio files. Top-level controller that presents view controllers one at a time, selected by a toolbar along the bottom of the screen. A standard view controller that presents a term and it's dictionary definition.
You can check modalViewController
property of parent view controller like this:
if ([self.parentViewController.modalViewController isEqual:self]) {
NSLog(@"Modal");
} else {
NSLog(@"Push");
}
Just remember to check it after the view has been pushed/presented.
This works for me:
if(self.presentingViewController){
//modal view controller
}else{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With