4

I'm trying to convert this to Monotouch C#:

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackOpaque]; 

But on the Appearance object there doesn't seem to be a Bar Style.

Is there a work around or alternative access point?

Botonomous
  • 1,706
  • 1
  • 15
  • 37
Ian Vink
  • 63,888
  • 100
  • 326
  • 544

1 Answers1

5

This property is not decorated with UI_APPEARANCE_SELECTOR in the Objective-C header files. The initial MonoTouch Appearance work was based on that documentation (but we added more cases over time).

However the way Apple implement it's appearance support allows a lot of undocumented things will work (and hopefully continue to work if Apple change it's internal representation).

Anyway this means you can hack around this a bit, e.g. by doing something like:

IntPtr handle = UINavigationBar.Appearance.Handle;
var appearance = new UINavigationBar (handle);
appearance.BarStyle = UIBarStyle.BlackOpaque;
poupou
  • 43,207
  • 6
  • 76
  • 172