0

I have created an iPad storyboard application using the newest version of Monotouch. My first screen is a login screen that I only want to show if the user has not saved his credentials. If credentials are available I want to instead navigate to the UITabBarController that is the second scene. I can't seem to find any documentation on how to do this. I tried creating an instance of the UITabBarController and pushing to it but it does not work.

homeScreen = new HomeTabBarNavigator(this.Handle);
this.NavigationController.PushViewController(homeScreen,true); 

HomeTabBarNavigator is a UITabBarController that is already linked to other scenes. I get the following error:

[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set   to an instance of an object

I assume I am getting this error because I have not defined any views to the ViewControllers property of my HomeTabBarNavigator. I was hoping that those views were already defined but that does not seem to be the case. Any ideas.

BrandonG
  • 876
  • 11
  • 20

1 Answers1

0

The best solution I could find is to call PerformSegue on the controller. Here is some example code:

this.PerformSegue("LoginSegue",this);

The controller that is loaded is the LoginController, and LoginSegue is a Segue that points to the HomeTabBarNavigator. While it is not perfect, the applications loaded the tabbar properly.

I used this stackoverlflow iOS question as the basis for my solution.

Community
  • 1
  • 1
BrandonG
  • 876
  • 11
  • 20