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,746
  • 1
  • 16
  • 39
Ian Vink
  • 66,960
  • 104
  • 341
  • 555

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,413
  • 6
  • 77
  • 174