Upgrade notes for MvvmCross 5.x on iOS
28 Jun 2017 | MvvmCross XamarinIMvxModalIosView or MvxModalNavSupportIosViewPresenter could not be found
MvvmCross has replaced the presenter logic, which before looked for the IMvxModalIosView interface in order to figure out how to present a ViewController. You should instead use the MvxModalPresentation attribute for your ViewController.
Previously you also had to use MvxModalNavSupportIosViewPresenter for it to understand the IMvxModalIosView interface. This is now all baked into the default presenter.
Previously you also had to use MvxModalNavSupportIosViewPresenter for it to understand the IMvxModalIosView interface. This is now all baked into the default presenter.
For this attribute you can also give it a couple of hints about how to display itself through a couple of properties.
- Animated, set this to false to disable animations when presenting your modal ViewController, defaults to true
- PreferredContentSize, set this to your content size on iPad, since they are not shown full screen default there
- ModalTransitionStyle, set this to the desired transition style, cover, flip, cross dissolve or curl, this will not work when Animated is set to false, defaults to CoverVertical
- ModalPresentationStyle, set this to the desired presentation style. This depends on the LayoutSize and in most cases on iPhone will default to FullScreen. This is mostly to change presentation on iPads.
Here is how the changes will reflect in your code:
Changing to the new presenter for Modals is pretty painless.
CreateNavigationController has changed signature
The MvxIosViewPresenter has changed the signature of CreateNavigationController, this is luckily a very simple change.
MvxTabBarViewController is presented as child?
Another thing in the new presenter for iOS, is that some ViewControllers, cannot be presented as children and need to be presented as root instead. This is something that will be fixed in MvvmCross 5.0.4 since this is unwanted behavior. You should be in control of how you want your ViewControllers presented. For now in 5.0.0-5.0.3 you can make a small change to fix this.
MvvmCross.Dialog is gone?
Yes. It was unmaintained and upstream MonoTouch.Dialog has been unmaintained for just as long time. The MvvmCross team does not want to support something that no one wants to fix.
What should you use instead? How about Xamarin.Forms? Or plain iOS Tables and Views? Sorry, no shortcuts here. You could recompile Dialogs from MvvmCross 4.x against 5.x yourself.
What I have opted for is using MvxTableViewController and making my own Adapters for cases where I need to display different kind of cells, groupings etc. It is not that much work and you are not dependent on a 3rd party library here. You can still bind MvxTableViewCells to whatever you want and TwoWay bindings work much better than MonoTouch.Dialogs ever did.
What I have opted for is using MvxTableViewController and making my own Adapters for cases where I need to display different kind of cells, groupings etc. It is not that much work and you are not dependent on a 3rd party library here. You can still bind MvxTableViewCells to whatever you want and TwoWay bindings work much better than MonoTouch.Dialogs ever did.