Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Black Screen when using a Login page with Sidebar Navigation

$
0
0

Hi!

I'm using the Sidebar Navigation lib (https: // components . xamarin . com / view / sidebarnavigation), and here is my code snippet:

AppDelegate.cs

    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        Window = new UIWindow(UIScreen.MainScreen.Bounds);

        if (isAuthenticated)
        {
            Window.RootViewController = new RootViewController();
        }
        else
        {
            Login screenLogin = new Login();
            screenLogin.OnLoginSuccess+= ScreenLogin_OnLoginSuccess
            Window.RootViewController = screenLogin ;
        }

        Window.MakeKeyAndVisible();

        return true;
    }

    private void ScreenLogin_OnLoginSuccess(object sender, EventArgs e)
    {
        isAuthenticated = true;
        Window.RootViewController = new RootViewController();
        Window.MakeKeyAndVisible();
    }

RootViewController.cs

    public partial class RootViewController : UIViewController
    {
        public SidebarController SidebarController { get; private set; }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            SidebarController = new SidebarController(this, new Home(), new Menu());
        }
    }

My Login screen is a UIViewController. The fundamental is: if user is not authenticated, so, i show the login page. When the user enter the correct credentials, i call the event 'OnLoginSuccess', that is signed in AppDelegate. So, i change the isAuthenticated var to true and set my RootViewController class as Window.RootViewController and call Windows.MakeKeyAndVisible();

When i testing this code at emulator, works fine (iphone 5s, iphone 6s+, ipad pro 9.7). But, in a real device (iphone 6 and iphone 6s) only appears a Black Screen after the login.

All real devices are using iOS 11.1 and 11.0.3.

I'm little bit frustrated.

Thanks for the help!


Viewing all articles
Browse latest Browse all 204402

Trending Articles