2012-10-15 38 views
0

通常,要在简单模式下更改部分的特征(字体,颜色),我们必须从头开始创建整个视图。MonoTouch.Dialog:更改部分颜色

如果需要在颜色/尺寸上进行简单的更改,是否有更简单的方法可以做到这一点?

这就是我倾向于做:

var header = new UILabel(new RectangleF(0, 0, 320, 25)){ 
     Font = UIFont.BoldSystemFontOfSize (22), 
     TextColor = UIColor.White, 
     BackgroundColor = SomethingPretty, 
     Text = "Something" 
}; 

Section secGroup = new Section(header); 

enter image description here

回答

2

这似乎是最简单的方法:

var header = new UILabel(new RectangleF(0, 0, 320, 25)){ 
    Font = UIFont.BoldSystemFontOfSize (22), 
    TextColor = UIColor.White, 
    BackgroundColor = SomethingPretty, 
    Text = "Something" 
}; 

Section secGroup = new Section(header); 
+1

您也可以创建你自己通过覆盖CreateSizingSource上浆源()并在你的源代码覆盖GetViewForHeader()。但是,你最终会从头开始创建视图。 – Krumelur