MonoTouch.Dialog中没有显示LeftBarButtonItem和RightBarButtonItem DialogViewController

Kru*_*lur 4 c# xamarin.ios monotouch.dialog

MonoTouch是5.2.12.iOS是v5.1.1(模拟器)

好像我在这里错过了一个重要的难题.我是子类DialogViewController并将其设置为我的UINavigationController中唯一的控制器.在ViewWillAppear子类中DialogViewController,我正在尝试设置左右栏按钮项:

this.NavigationController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, this.HandleDoneButtonTouched );
Run Code Online (Sandbox Code Playgroud)

他们俩都没有露面.但是会显示标题.如果我调试,我可以看到项目已正确设置.

我也尝试SetItems()在导航控制器上使用:也没有效果.

导航控制器以页面形式呈现在模式中.

Bri*_*ian 7

导航项目通常不会通过导航控制器更新.而是通过视图控制器上的NavigationItem属性更新它们:

this.NavigationItem.SetRightBarButtonItem(
        new UIBarButtonItem(UIImage.FromFile("some_image.png")
        , UIBarButtonItemStyle.Plain
        , (sender,args) => {
           // button was clicked
        })
    , true);
Run Code Online (Sandbox Code Playgroud)

http://docs.xamarin.com/ios/recipes/Content_Controls/Navigation_Controller/Add_a_Nav_Bar_Right_Button