2

MVVMCross ios の場合、「ShowViewModel」のデフォルトのスライド効果の代わりに、FlipHorizo​​ntal スタイルなどの別の TransitionalStyle を使用するにはどうすればよいですか?

[Register("SearchResults")]
public class SearchResultsView : MvxTableViewController
{
    public override void ViewDidLoad()
    {
        Title = "List";
        base.ViewDidLoad();

        var mapButton = new UIButton(new RectangleF(0, 0, 65, 30));
        mapButton.SetBackgroundImage(UIImage.FromBundle("images/map_btn.png"), UIControlState.Normal);
        mapButton.TouchUpInside += MapButtonClicked();
        var rightButton = new UIBarButtonItem(mapButton);
        NavigationItem.RightBarButtonItem = rightButton;

        var bindings = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>();
        //bindings.Bind(mapButton).To(x => x.ShowMapCommand); //how to do with binding command?
        bindings.Apply();
    }

    private EventHandler MapButtonClicked()
    {
        return (sender, args) =>
        {

            var mapView = new SearchResultMapView {ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal};
            var navigationController = new UINavigationController(mapView);
            PresentViewController(navigationController, true, null);
        };
    }
}
4

2 に答える 2

1

ViewModel/View は Presenter を使用して表示されます。

ナビゲーション コントローラーのモーダル表示には、MvxModalNavSupportTouchViewPresenter.csを使用する人もいます。

このプレゼンターはCreatePresenter、セットアップでオーバーライドすることで使用できます。

    protected override IMvxTouchViewPresenter CreatePresenter()
    {
        return new MvxModalNavSupportTouchViewPresenter(ApplicationDelegate, Window);
    }

IMvxModalTouchViewこれが完了すると、継承を追加ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;し、コンストラクターで設定することにより、遷移効果を実現できるはずですSearchResultMapView

    public class SearchResultMapView 
         : MvxViewController, IMvxModalTouchView
    {
        public SearchResultMapView()
        {
            ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
        }

        // more code here....
    }

あるいは、ビュー/ビューコントローラーの表示を完全にカスタマイズしたい場合は、カスタム プレゼンターを実装するのはかなり簡単です。詳細については、http://slodge. blogspot.co.uk/2013/06/presenter-roundup.html

于 2013-07-18T21:21:06.440 に答える
0

@羽

プッシュされたビュー コントローラーの新しいビューに閉じるボタンを追加し、次のように touchupinside をオーバーライドするだけです。

private void CloseBtnTouchUpInside(object sender, EventArgs eventArgs)
{
            DismissModalViewController(false);
}
于 2015-05-05T13:23:06.707 に答える