3

What is the best way to set a background image (below all controls) in Monotouch.Dialog? I am using the Elements API of Monotouch.Dialog.

poupou
  • 43,413
  • 6
  • 77
  • 174
Brian David Berman
  • 7,514
  • 26
  • 77
  • 144

1 Answers1

3

The main trick is to set the TableView background colour to Clear then setting the ParentViewController.View to your image, like:

class MyDialogViewController : DialogViewController {

    public MyDialogViewController (RootElement root) : base (root)
    {
    }

    public override void LoadView ()
    {
        base.LoadView ();
        TableView.BackgroundColor = UIColor.Clear;
        UIImage background = UIImage.FromFile ("background.png");
        ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background);
    }
}
poupou
  • 43,413
  • 6
  • 77
  • 174