使用后退按钮样式创建 UIBarButtonItem [英] Create UIBarButtonItem with back button style
问题描述
我正在寻找一种以编程方式创建 UIBarButtonItem
的方法,它看起来像 UINavigationBar
的后退按钮.显然,后退按钮只有在按下 UINavigationController
后才会出现.
I'm looking for a way to create programmatically an UIBarButtonItem
that looks like a back button of UINavigationBar
.
Apparently seems like that the back button appears only after a push on the UINavigationController
.
所以我只能插入一个取消"样式的按钮.但我的目标是创建一个具有New Item"样式的按钮.
So I'm able to insert only a button with the "cancel" style. But my goal is to create a button with the "New Item" style.
想法?
推荐答案
简单的回答是你做不到.
the short answer is you cannot do it.
你可以保存一张图片,你可以把图片放到那个位置,但是后退按钮是由UINavigationBar
的私有部分管理的.
you can save an image and you can put the image to that position, but the back button is managed by private part of the UINavigationBar
.
这篇关于使用后退按钮样式创建 UIBarButtonItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!