简体   繁体   中英

Start different Storyboard depending on user login-status at boot (Xamarin.iOS)

I'm converting my Android App to iOS. I already created the login screen and a user can log in. If he enters the correct credentials his data is stored using NSUSerDefault .

What I don't know is how to achieve that when the app starts it checks the NSUserDefault for the values and decides wether the user has to login or not.

Since Segues can't be made programmatically like in Android ( StartActivity() ) and need a button or something similar what would be the solution to my problem?

on AppDelegate class:

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {

            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method


            UIViewController yourViewController = UIStoryboard.FromName("yourStoryboard",NSBundle.MainBundle).InstantiateViewController("yourViewController_StoryboardID");


            this.Window = new UIWindow(UIScreen.MainScreen.Bounds);
            UINavigationController navigationController = new UINavigationController(yourViewController);

            this.Window.RootViewController = navigationController;
            this.Window.MakeKeyAndVisible();


            return true;
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM