【发布时间】:2012-04-02 13:31:34
【问题描述】:
当我将 MonoTouch.Dialog 背景颜色设置为 uiclear(transparent) 时,它会抛出异常,为什么?以及如何将其设置为透明。
未处理的异常:System.NullReferenceException:对象引用未设置为 MyDialogViewController.cs 中对象 MyDialogViewController.LoadView () [0x00016] 的实例:ParentViewController.View.BackgroundColor = UIColor.Clear
public class MyDialogViewController: DialogViewController
{
public MyDialogViewController (RootElement root) : base (root)
{
}
public override void LoadView()
{
base.LoadView ();
this.TableView.BackgroundColor = UIColor.Clear;
ParentViewController.View.BackgroundColor = UIColor.Clear;
}
}
public void xxxxx(){
var menu = new RootElement(""){
new Section ("Demo"){
new EntryElement("Name", "",""),
},
};
var menuDVC = new MyDialogViewController (menu) {
Autorotate = true
};
this.View.AddSubview(menuDVC.View);
}
【问题讨论】:
标签: c# ios xamarin.ios monotouch.dialog