gpt4 book ai didi

c# - LeftBarButtonItem 和 RightBarButtonItem 未显示在 MonoTouch.Dialog DialogViewController 中

转载 作者:太空狗 更新时间:2023-10-30 00:43:18 24 4
gpt4 key购买 nike

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

似乎我在这里遗漏了一 block 重要的拼图。我正在子类化 DialogViewController 并将其设置为我的 UINavigationController 中的唯一 Controller 。在子类 DialogViewControllerViewWillAppear 中,我尝试设置左右栏按钮项:

this.NavigationController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, this.HandleDoneButtonTouched );

他们都没有出现。但是会显示标题。如果我调试,我可以看到项目设置正确。

我还尝试在导航 Controller 上使用 SetItems():也没有效果。

导航 Controller 以模态方式呈现在页面表中。

最佳答案

导航项通常不会通过导航 Controller 更新。相反,它们通过 View Controller 上的 NavigationItem 属性进行更新:

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

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

关于c# - LeftBarButtonItem 和 RightBarButtonItem 未显示在 MonoTouch.Dialog DialogViewController 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11667554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com