作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我有 vc A 和 vc B。当我执行从 A 到 B 的推送转场时,会自动创建一个后退按钮。这很好,但我想使用 SetTitleTextAttributes 将此按钮的文本颜色更改为黑色。
通过阅读与此相关的其他问题,我了解到您必须编辑将出现在 vc A 中的 vc B 中的后退按钮。像这样的东西:
在 vc A 上:
this.NavigationController.NavigationItem.BackBarButtonItem.SetTitleTextAttributes (textAttrButton, UIControlState.Normal);
在某些问题上,他们说要将其放在 viewWillAppear 中,其他人则说就在您对 vc B 执行 segue 之前。在这两种情况下,我都收到以下错误:
object reference not set to an instance of an object
这是在 vc B 上:
最佳答案
更好的选择是为此使用 UIAppearance
。适用于整个应用中的所有 UIBarButtonItems
,但需要 iOS。
UIBarButtonItem.Appearance.SetTitleTextAttributes(new TextAttributes { TextColor = UIColor.Black }, UIControlState.Normal);
关于c# - 将 "SetTitleTextAttributes"应用于后推按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17490758/
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Local executing hook after a git push? git 有许多钩子(Hook)
我是一名优秀的程序员,十分优秀!