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

本文关键字:背景 图像 设置 Dialog 何使用 Monotouch | 更新日期: 2023-09-27 18:17:10

Monotouch.Dialog中设置背景图像(在所有控件下方)的最佳方法是什么?我使用Monotouch.DialogElements API

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

主要的技巧是将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);
    }
}