Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get TopViewController in iOS native layter #18

Open
ewoody opened this issue Apr 20, 2018 · 0 comments
Open

Can't get TopViewController in iOS native layter #18

ewoody opened this issue Apr 20, 2018 · 0 comments

Comments

@ewoody
Copy link

ewoody commented Apr 20, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant