【问题标题】:How to set a background image with Monotouch.Dialog如何使用 Monotouch.Dialog 设置背景图像
【发布时间】:2011-12-09 04:34:15
【问题描述】:

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

【问题讨论】:

    标签: c# ios xamarin.ios monotouch.dialog


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2013-03-13
      • 2011-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多