问题
Maybe I'm missing something obvious here, but using MvvmCross and loading an view via a command:
public ICommand LoadAnotherViewCommand
{
get { return new MvxCommand(() => ShowViewModel<MyOtherView>()); }
}
How can I hook in and control the animation that occurs during the transition? Currently, all the transitions are left-to-right sliding transitions, but it's confusing when the user navigates back to a view and sees the same left-to-right transition.
Update:
I've been trying to figure out how to use a class derived from MvxTouchViewPresenter
to achieve this with little success. I think I need to overload either Show(Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request)
and/or Show(Cirrious.MvvmCross.Touch.Views.IMvxTouchView view)
, but can quite figure out how to make it work. IMvxTouchView
is ultimately derived from UIViewController
so I can't use it in UIView.Transition
. Also, determining which view is requested and which view I'm coming from seems a little confusing. If I look at request.ViewModelType
I would expect to get the type of view model being requested, but instead it appears to be the view model you are coming from. Similarly, I would expect CurrentTopViewController
to be the current view, but it appears to be the requested view?!? Also, I notice that trying to retrieve CurrentTopViewController
causes a null reference exception if called to early (before any views have been presented). Presumably because internally _masterNavigationController
is null.
来源:https://stackoverflow.com/questions/17860155/how-to-specify-view-transitions-on-iphone