Here is how we want to get the top view controller in Xamarin iOS native layer,
vc = UIApplication.SharedApplication.KeyWindow.RootViewController;
while (vc.PresentedViewController != null)
{
vc = vc.PresentedViewController;
}
if (vc is UINavigationController)
{
vc = ((UINavigationController)vc).TopViewController;
}
However, we can't get correct top view controller when we are navigating to a page but It works fine if the top page is a modal page.
Here is how we want to get the top view controller in Xamarin iOS native layer,
However, we can't get correct top view controller when we are navigating to a page but It works fine if the top page is a modal page.