iOS: Monotouch bindings for Appearance on Bar Style missing?

北慕城南 提交于 2019-12-21 18:58:04

问题


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?


回答1:


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;


来源:https://stackoverflow.com/questions/14531463/ios-monotouch-bindings-for-appearance-on-bar-style-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!