MvvmCross Using Modal ViewController from Tab

I searched SO in other places for MvvmCross and Modal, but one existing answer does not help us.

We are developing a cross-platform application using MonoTouch and MvvmCross, which seems to be a pretty powerful combination. However, we have some problems with navigation, which we are gradually cracking! Current issue is

The application works with TabBarController, and each tab has navigation to further levels - this works fine. The client, however, wants the Start button on one of the tabs to display a modal view (which hides everything else, especially the tab bar), which then has its own levels, working just like the UINavigationController, with the ability to return to tabBarController in any time.

We managed to display one kind of modal view, but we were stuck in loading new views and pushing back.

Any help / advice appreciated!

+4
source share
1 answer

I think you want to do this to configure the presenter to wrap your UIViewController in a UINavigationController - and then it is a UINavigationController file?

To achieve this, the code in a recent Pull request from @DeapSquatter can help - https://github.com/slodge/MvvmCross/pull/9 - I think you can use its modal nav presenter to achieve the effect you are looking for:

if (view is IMvxModalTouchView) { if (_currentModalViewController != null) throw new MvxException("Only one modal view controller at a time supported"); var newNav = new UINavigationController(); newNav.PushViewController(view as UIViewController, false); _currentModalViewController = view as UIViewController; PresentModalViewController(newNav, true); return; } 

The mvvmcross architecture is intentionally extensible and customizable here - while we are including some of the base classes of the Presenter, it is very likely that people will want to customize how the various views will be presented based on the application. In addition to the simplest demo applications, I expect that most mvvmcross applications on touch will come with a custom presenter inside.

Hope that helps

Stewart

+5
source

All Articles