Created
July 15, 2018 09:00
-
-
Save trinnguyen/7a7d840048abf1cb1429a2cb9275fd2e to your computer and use it in GitHub Desktop.
Xamarin ios check wether a ViewController is presented as Modal. Support NavigationController (not TabBar)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool CheckIsModalVC(UIViewController viewController) | |
{ | |
// find root | |
var vc = viewController; | |
while (vc.NavigationController != null) | |
{ | |
vc = vc.NavigationController; | |
} | |
// check cur | |
if (vc.PresentingViewController != null) | |
{ | |
return vc.PresentingViewController.PresentedViewController == vc; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment