I set UINavigationBar background image at root view controller, but i need to remove background image at detail view controller.
With Obj-C I use this code:
if ([[UINavigationBar class] respondsToSelector:@selector(appearance)])
{
[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
}
so when i use this code in MonoTouch:
this.NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default);
i receive this error:
System.ArgumentNullExeption
Argument cannot be null
Parameter name: backgroundImage
How can I remove the background image?
This looks like a bug. AFAICT
nullshould be allowed in this method to remove the background.I’ll be fixing this asap for the next stable release of MonoTouch. If this is blocking you just fill a bug report at http://bugzilla.xamarin.com and we’ll provide you an hotfix to workaround this.
EDIT: this is fixed and will be available in the next releases (e.g. 5.2.12 for stable)