- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
MonoTouch 是 5.2.12。 iOS 是 v5.1.1(模拟器)
似乎我在这里遗漏了一 block 重要的拼图。我正在子类化 DialogViewController
并将其设置为我的 UINavigationController 中的唯一 Controller 。在子类 DialogViewController
的 ViewWillAppear
中,我尝试设置左右栏按钮项:
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);
关于c# - LeftBarButtonItem 和 RightBarButtonItem 未显示在 MonoTouch.Dialog DialogViewController 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11667554/
在我的代码中,我以编程方式将带有 UIButton 的 leftBarButtonItem 更改为 UIActivityIndicatorView,我想知道如何在更改时执行翻转过渡,有什么想法吗?
我正在尝试像这样添加一个 leftbarbuttonitem: 使用此代码: let button = UIButton.init(type: .custom) button.setI
我试图在几乎每个页面中设置一个自定义后退按钮,并且我在每个页面中重复相同的代码; let buttonItem = UIBarButtonItem(image: UIImage(named: "arr
我正在尝试以编程方式设置左按钮栏项目的大小,但我做不到。 这是我的代码: let backButton = UIButton(frame: CGRect(x: 0, y: 0, wid
我一直在开发一个 iOS 应用程序,并且在使用图像作为导航栏中的左栏按钮项目时遇到了问题。我尝试过以下方式: UIImage *backButtonImage = [UIImage imageName
谁能告诉我为什么这段代码不起作用? self.backButton = [UIButton buttonWithType:UIButtonTypeCustom]; [self.backButton s
我有两个 View A 和 View B。 从 View A 到 View B,我没有使用导航 Controller ,我使用了 performSegueWithIdentifier() 并且我不想使
这个问题在这里已经有了答案: 已关闭11 年前。
我有一个 UIViewController,它想要在通过 leftBarButtonItem 关闭时执行一些代码(并从堆栈中弹出以返回到父 View Controller )。该 View 有自己的
我有一个 UINavigationController,其中我的 AHViewController 作为 Root View Controller 。 然后我尝试从 AHViewController
我有一个文本编辑 View ,我想在编辑文本后返回 Root View 之前提示用户。 到目前为止我已经尝试过了。 self.navigationItem.leftBarButtonItem.titl
我需要在导航栏中有一个按钮,但它不应该是“可点击的”。我发现我可以通过将 .isEnabled 属性设置为 false 来简单地禁用该按钮,但这对我不想要的按钮有视觉效果(使其显示为灰色并且非常微弱)
我有一个 UITableViewController,我想要一个左导航按钮,而不是右导航按钮。 rightBarButtonItem 是灰色的,我不能删除,也不能添加左边的。我想我有点困惑,不明白如何
我正在尝试以编程方式在我的 View Controller 的导航栏中添加一个 leftBarButtonItem(此 View Controller 嵌入在导航 Controller 中)。我在 v
我使用了 2 个条形按钮项目。一个用于后退按钮,第二个用于标题。它工作正常。但是当标题字符串很大时,标题会向左移动并且不会出现后退按钮,但它可以工作。 我还使用了一个带有角标(Badge)按钮的 ri
我试图给 leftBarButtonItem 一个上边距,但它不起作用。我可以将它向右移动,但不能向下移动。 self.navigationItem.leftBarButtonItem?.setTit
所以我在 leftBarButtonItem 中有两个按钮。这是我的代码。 NSString *todayString = @"..."; UIBarButtonItem *todayButton =
我有root ViewController 和detailed ViewController。当我推送到 detailedViewController 时,我得到带有根标题的 leftBarButto
我想向 leftBarButtonItem 添加一个后退箭头,使其在视觉上看起来就像是一个普通的后退按钮,尽管它的功能略有不同。 有办法吗? 最佳答案 如果您使用导航 Controller ,您可以使
如何为 UINavigationController 中推送的 View Controller 的所有后退按钮设置自定义图像? 我的问题是: 在位置方面必须看起来像 leftBarButtonItem
我是一名优秀的程序员,十分优秀!