Reputation: 65
This is probably a stupid question, but as I haven't found an answer anywhere else I will ask it here.
My question is: How can I change which view controller is being viewed. In my case I want the user to open the app, and if the user hasn't already filled out the setup form the app will change from the home page to the setup page.
public override void ViewDidLoad()
{
base.ViewDidLoad();
//Initial setup check
dataBase.SetBool(false, "setUpComplete");
if (dataBase.BoolForKey("setUpComplete") == false)
{
//Code to change page here
}
}
Thanks to anyone who decides to answer this!
Upvotes: 2
Views: 79
Reputation: 17402
You can try like this
public override void ViewDidLoad()
{
base.ViewDidLoad();
//Initial setup check
dataBase.SetBool(false, "setUpComplete");
if (dataBase.BoolForKey("setUpComplete") == false)
{
var objSetUpViewController=new SetUpViewController()
this.NavigationController.PushViewController (objSetUpViewController, true);
}
else
{
//If setup completed move on HomeViewController
var objHomeViewController=new HomeViewController()
this.NavigationController.PushViewController (objHomeViewController, true);
}
}
Upvotes: 1