简体   繁体   English

iOS / Xcode-导航项BackBarButtonItem标题显示了以前的控制器之一

[英]iOS / Xcode - Navigation Item BackBarButtonItem title shows the one of the previous controller

i have 2 View Controllers connected by a segue within a Navigation Controller and I edited the back items titles in Interface Builder . 我有2个View Controller通过导航控制器内的Segue连接,并且在Interface Builder中编辑了后项标题。

My problem is, that the BackBarButtonItem of the second controller shows the title of the first (and presenting) controller's BackBarButtonItem , no matter what I set for Back on the second controller's NavigationItem. 我的问题是,无论我在第二个控制器的NavigationItem上为Back设置了什么,第二个控制器的BackBarButtonItem都将显示第一个(并显示)控制器的BackBarButtonItem的标题。

The only thing I've done is setting the leftBarButtonItem for the first Controller: 我唯一要做的就是为第一个Controller设置leftBarButtonItem:

self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Close", style: UIBarButtonItemStyle.Plain, target: self, action: "backTapped:")

Now all NavigationItems of presented Controllers show "Close". 现在,所显示控制器的所有NavigationItems均显示“关闭”。 Does anyone have an idea, what's going on? 有谁知道,这是怎么回事?

Thanks in advance 提前致谢

您必须在要执行后退操作的视图控制器上(例如,在前一个上)配置所需的后退按钮项目标题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM