如何复制后退按钮?
我知道更改后退按钮文本颜色的唯一方法是制作自己的自定义按钮:
self.navigationItem.backBarButtonItem = yourCustomBackButton;
我的问题是:如何创建一个后退按钮,该按钮考虑色调颜色并且看起来与默认值完全相同后退按钮除了文本的颜色(除非它是白色的)?
I understand that the only way to change the color of the text of the back button is to make your own custom button:
self.navigationItem.backBarButtonItem = yourCustomBackButton;
My question is: How do I create a back button that takes tint color into account and looks exactly the same as the default back button except for the color of the text (unless it's white)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将类别添加到 UINavigationBar 并在那里设置其背景颜色。此代码还展示了如何使用图像。
以下是使用 RGB 192,93,0 作为背景棕色的一些示例输出:
Add a category to the UINavigationBar and set it's background color there. This code also shows how to use an image.
Here's some sample output using RGB 192,93,0 for background brown:
确实无法更改后退按钮的文本颜色。但是,您可以将自定义视图分配给 leftBarButtonItem 属性。我整理了一个简单的小项目,展示了如何重新创建标准 iOS UI 的输入/输出动画。需要一些技巧,但您应该能够将带有标签的按钮分配给自定义视图并更新它。
https://github.com/typeoneerror/BBCustomBackButtonViewController
It's really not possible to change the text color of the back button. You can however assign a custom view to the leftBarButtonItem property. I've put together a simple little project showing how to do that that recreates the in/out animation of the standard iOS UI. Takes a bit of hacking, but you should be able to assign a button with a label in it to the custom view and update that.
https://github.com/typeoneerror/BBCustomBackButtonViewController