How to specify view transitions on iPhone

依然范特西╮ 提交于 2020-01-17 08:29:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!