2011-03-15 103 views
4

我使用MonoTouch.Dialog DialogViewController创建一个漂亮的视图。Monotouch.Dialog - 设置后退按钮

private RootElement _createRoot(){ 
    return new RootElement ("Buy a Property Report"){ 

      new Section (""){ 
       new StringElement ("View Sample",()=>{ }), 
       new StringElement ("Enter Address",()=>{ }), 
       new StringElement ("Locate This House",() => { }), 
       new StringElement ("My Reports",() => { }) 
      } 
     }; 
} 

下列屏幕上我需要有一个返回按钮是不同的,那么我在指定的上一个“购买物业报告”,“家”

我这样做。

public override void ViewDidLoad() 
{ 
    base.ViewDidLoad(); 
     this.NavigationController.NavigationBar.TopItem.Title = "Home"; 
} 

有没有办法做到这一点在Monotouch.Dialog呢?

回答

2

我不知道我理解你的问题很好,但尝试使用此对话框控制器上:

this.NavigationItem.BackBarButtonItem.Title = "Home"; 
+2

同时在DVC生命周期什么时候做呢?如果我在'ViewDidLoad'中执行它,BackBarButtonItem仍然为空。如果我在'ViewDidAppear'中执行此操作,则可以在更改为“主页”之前简要查看默认标题。 – Tyson 2012-09-21 00:44:17