2012-10-15 111 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