为什么外观设置在 Monotouch 6 中的控件上不起作用? 我正在设置属性
UILabel.Appearance.Font = UIFont.FromName("Fontname", 16);
UILabel.Appearance.BackgroundColor = UIColor.Clear;
但是当我创建标签时
UILabel mLabel = new UILabel(new RectangleF(0, 0, width, height));
它看起来像默认标签。具有白色背景和深色文本。 如果我直接设置属性,它就可以正常工作
mLabel.Font = UIFont.FromName("Fontname", 16);
mLabel.BackgroundColor = UIColor.Clear;
给了我一个正确的结果。
最佳答案
好像是这个问题is not specific to MonoTouch .
引用约书亚 another thread ,
OK, it turns out that you cannot style any
UILabel
properties using theUIAppearance
proxy.While the
UILabel
class conforms to theUIAppearanceContainer
protocol, a check of UILabel.h shows that none of its properties are marked withUI_APPEARANCE_SELECTOR
, the prerequisite for the use ofUIAppearance
.
这很烦人。
关于ios - Monotouch 中的 UILabel 外观,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13266344/