快速重命名后退导航项 [英] Swift renaming the back navigation item
问题描述
我正在尝试在导航控制器中编辑后退项目的图块.
I'm trying to edit the tile of the back item in the navigation controller.
我有这个场景,导航控制器->表格视图控制器-> TableViewController .
在第二个TableViewController中,我要将back项目从" xxxx "重命名为" Back ".
In the second TableViewController I want to rename the the back item from "xxxx" to "Back".
是否可以通过 StoryBoard 进行操作,还是应该以编程方式进行操作?
Is there a way to do via the StoryBoard, or should I do it programmatically?
这是我尝试过的方法,但是不起作用:
This is what I've tried but it does not work:
let backItem = UIBarButtonItem()
backItem.title = "Back"
navigationItem.backBarButtonItem? = backItem
或
navigationItem.backBarButtonItem?.title = "back"
它们都在viewDidLoad()中
both of them in the viewDidLoad()
推荐答案
是,您可以使用 StoryBoard
来做到这一点.在 Attribute Inspector
中设置之后,在
,标题为 NavgationController
中嵌入的 TableViewController
中选择 NavgationItem
.返回按钮 Back
.
Yes, you can do that with StoryBoard
. Select the NavgationItem
in TableViewController
that you have embedded in NavgationController
after that in the Attribute Inspector
set the Back Button
with title that you want in your case it is Back
.
这篇关于快速重命名后退导航项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!