user686483
user686483

Reputation: 1506

Styling headers on a DialogViewController

I'm wanting to style the headers on my DialogViewController. The content of the controller is loaded from a JSON response.

How can I style the header elements with background colours etc?

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;

Upvotes: 1

Views: 249

Answers (1)

Eric
Eric

Reputation: 472

A Section, has a HeaderView and FooterView property, you can set those there.

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

Upvotes: 1

Related Questions