简体   繁体   English

TabBarController上NavigationBar中的AddButton并从ViewControllers调用Segue

[英]AddButton in NavigationBar on TabBarController and call Segue from ViewControllers

i have a TabBarController with two ViewController. 我有一个带有两个ViewController的TabBarController。 One of them has a TableView. 其中之一具有TableView。 I want to set in the NavigationBar of ViewController with have the TableView a BarButtonItem (Add), so that the BarButtonItem is only show when the TableView is in front. 我想在ViewController的NavigationBar中设置TableView一个BarButtonItem(添加),以便仅当TableView在前面时才显示BarButtonItem。 But it doesn't work. 但这是行不通的。 I never see the BarButtonItem. 我从没见过BarButtonItem。 So i put it on then TabBarController an i see it, but in both ViewController. 所以我把它放在TabBarController上,我看到了,但是在两个ViewController中。 That's not that what i want. 那不是我想要的。 An i can not call the segue, from the ViewController (TableView) to the DetailViewController, because my TabBarController not know it. 我无法调用segue,从ViewController(TableView)到DetailViewController,因为我的TabBarController不知道。

What is the right solution to do this? 正确的解决方案是什么? How can i put a BarButtonItem on then NavigationBar on a ViewController that ist Client of a TabBarController? 我怎样才能将一个BarButtonItem放在一个TabController客户端的ViewController的NavigationBar上呢?

Thanks PS: i coding in swift ;-) 谢谢PS:我迅速编码;-)

I post a Picture of my actual Storyboard, so you can understood me better. 我张贴了我的实际情节提要的图片,因此您可以更好地了解我。

"a picture of storyboard" “情节提要的图片”

When i place my add-button at position one i can't call the seque for a new Item in the data of the tableview. 当我将添加按钮放置在第一个位置时,无法在表格视图的数据中调用新项的序列号。

When i place my add-button at position two i can call the segue, but i never see the button to click it. 当我将添加按钮放置在第二个位置时,我可以调用segue,但是我从来没有看到单击它的按钮。

my tabbarcontroller is showing when i clicked on detail for a cell on the tableview at the left on the picture. 单击图片左侧表格视图中某个单元格的详细信息时,我的tabbarcontroller就会显示。

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

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