I launch a Tab Bar Controller from my view with a segue. After editing the passed data, I need to dismiss the tab controller. The storyboard in Xcode won't allow me to add a Dismiss button on the Tab Controller (and shown on all the tabs.) Do I have to have a separate Dismiss button on each tab view? That seems rather clunky.
我从视图中使用segue启动了一个Tab Bar Controller。编辑传递的数据后,我需要关闭选项卡控制器。 Xcode中的故事板不允许我在选项卡控制器上添加一个“关闭”按钮(并显示在所有选项卡上。)我是否必须在每个选项卡视图上都有一个单独的“关闭”按钮?这看起来相当笨重。
What's the best way to handle this?
处理这个问题的最佳方法是什么?
1 个解决方案
#1
0
Each view which is connected to a tab bar in the Tab Bar Controller is a completely separate view. The tab bar just holds them together. If you would like to have a back button, you do have to have a separate button or gesture action on each view in the tab bar.
连接到选项卡栏控制器中的选项卡栏的每个视图都是完全独立的视图。标签栏只是将它们组合在一起。如果您想要一个后退按钮,则必须在选项卡栏中的每个视图上都有单独的按钮或手势操作。
However, you can easily dismiss the view with code instead of having to add four extra segues.
但是,您可以使用代码轻松关闭视图,而不必添加四个额外的segue。
self.dismissViewControllerAnimated(true, completion: {})
That line will dismiss your current view controller.
该行将关闭您当前的视图控制器。
#1
0
Each view which is connected to a tab bar in the Tab Bar Controller is a completely separate view. The tab bar just holds them together. If you would like to have a back button, you do have to have a separate button or gesture action on each view in the tab bar.
连接到选项卡栏控制器中的选项卡栏的每个视图都是完全独立的视图。标签栏只是将它们组合在一起。如果您想要一个后退按钮,则必须在选项卡栏中的每个视图上都有单独的按钮或手势操作。
However, you can easily dismiss the view with code instead of having to add four extra segues.
但是,您可以使用代码轻松关闭视图,而不必添加四个额外的segue。
self.dismissViewControllerAnimated(true, completion: {})
That line will dismiss your current view controller.
该行将关闭您当前的视图控制器。