How to remove background image from UINavigationBar

I set the background image of the UINavigationBar in the root view, but I need to remove the background image on the 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 get this error:

 System.ArgumentNullExeption Argument cannot be null Parameter name: backgroundImage 

How to remove background image?

+4
source share
1 answer

It looks like an error. AFAICT null must be enabled in this method to remove the background.

I will fix this as soon as possible for the next stable version of MonoTouch. If this is a lock, you simply fill out the bug report at http://bugzilla.xamarin.com and we will provide you with a fix to resolve this problem.

EDIT : this has been fixed and will be available in future releases (e.g. 5.2.12 for stability)

+4
source

Source: https://habr.com/ru/post/1411376/


All Articles