On the start of my iOS application (that I am building with Xamarin and MvvmCross), I want to immediately change UIViewController
to a UITabBarViewController
. My code:
public class MainViewModel : BaseViewModel
{
public void Initialization()
{
ShowViewModel<TabLayoutViewModel>(); // Breaks here
}
}
public class MainViewController : BaseViewController<MainViewModel>
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.ViewModel.Initialization();
}
}
public class TabLayoutViewController : MvxTabBarViewController<TabLayoutViewModel>
{
}
On the line ShowViewModel<TabLayoutViewModel>()
it throws an exception:
A TabBarViewController cannot be presented as a child. Consider using Root instead
I just want to push this controller on top of the stack. I know this is legal in plain iOS so there should be a way to do it with MvvmCross?