本文介绍了MVVMCross应用程序中的自定义导航控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于MVVMCross的应用程序上工作,需要使用自定义的UINavigationController,但是由于无法看到创建导航控制器的位置,我正努力查看如何做到这一点.

I'm working on an MVVMCross based app and need to use a custom UINavigationController but I'm struggling to see how I can do this as I can't see the point at which the navigation controller is created.

任何人都可以就如何在MVVMCross中使用自定义UINavigationController提供任何指导

Can anyone give any guidance on how a custom UINavigationController can be used within MVVMCross

推荐答案

您可以在自己的Presenter中通过覆盖CreateNavigationController来做到这一点:

You would do that in your own Presenter by overriding CreateNavigationController:

protected override UINavigationController CreateNavigationController(UIViewController viewController)
{
    var toReturn = base.CreateNavigationController(viewController);
    toReturn.NavigationBarHidden = false;
    toReturn.NavigationBar.TintColor = UIColor.FromRGB(15, 79, 140);
    toReturn.NavigationBar.BarTintColor = UIColor.FromRGB(228, 242, 231);
    toReturn.NavigationBar.Translucent = false;
    return toReturn;
}

根据需要进行修改. base.CreateNavigationController只会创建UINavigationController的实例.

Modify as needed. base.CreateNavigationController just creates an instance of UINavigationController.

这篇关于MVVMCross应用程序中的自定义导航控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 17:40