Swift renaming the back navigation item(Swift 重命名后退导航项)
问题描述
我正在尝试在导航控制器中编辑 返回项 的磁贴.
I'm trying to edit the tile of the back item in the navigation controller.
我有这个场景,Navigation Controller -> Table View Controller -> TableViewController.
在第二个 TableViewController 中,我想将后面的项目从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 做到这一点.选择 TableViewController 中的 NavgationItem 您已嵌入 NavgationController 之后,在 Attribute Inspector 中设置 Back Button 带有您想要的标题,它是 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.
这篇关于Swift 重命名后退导航项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Swift 重命名后退导航项
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
