Custom Navigation Controller in an MVVMCross App

2019-07-29 10:06发布

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.

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

1条回答
冷血范
2楼-- · 2019-07-29 10:52

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;
}

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

查看更多
登录 后发表回答