2013-04-04 47 views
1

我想在DialogViewController上設置標題樣式。控制器的內容是從JSON響應中加載的。在DialogViewController上設計標題

如何設置帶有背景顏色等的標題元素?

string responseString = string.Empty; 
     Uri uri = new Uri ("http://loca!host.com/sample.json"); 
     HttpWebRequest request = new HttpWebRequest (uri); 
     request.Method = "GET"; 

     HttpWebResponse response = request.GetResponse() as HttpWebResponse; 
     var obj = JsonValue.Load (new StreamReader (response.GetResponseStream())) as JsonObject; 
     if (obj != null) { 

      var root = JsonElement.FromJson (obj); 
      _rootVC = new DialogViewController (root); 


      var jsonSection = root["section-1"] as Section; 

回答

1

Section,有一個HeaderView和FooterView屬性,你可以在那裏設置它們。

var section = new Section() { 
       HeaderView = new UIImageView (UIImage.FromFile  ("caltemplate.png")), 
       FooterView = new UISwitch (new RectangleF (0, 0, 80, 30)), 
      };