问题描述
我正在基于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应用程序中的自定义导航控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!