问题
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:
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.
来源:https://stackoverflow.com/questions/43681201/custom-navigation-controller-in-an-mvvmcross-app