如何使用Monotouch.Dialog设置背景图片

3

如何在Monotouch.Dialog中设置一个背景图片(在所有控件下方)?我正在使用Monotouch.DialogElements API。

1个回答

3

主要的技巧是将TableView背景颜色设置为Clear,然后将ParentViewController.View设置为您的图片,例如:

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);
    }
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接