您好,我有一个项目,其中一个 TabBar Controller 作为 Root View Controller ,这个项目有 5 个 View 。
标签栏 [选项卡 1、选项卡 2、选项卡 3]
[带有导航 View Controller 的选项卡 1 表格 View ] [带有导航 View Controller 的选项卡 2,第二个表格 View ] [带有导航 View Controller 的选项卡 3 第三个表格 View ]
在第一个选项卡中,当用户点击行时,用户将移动到另一个带有嵌入式导航 View Controller 的 TableView 。此详细信息列表有 2 个 UITableViewRowAction,其中我显示另一个包含一些信息的 View 。问题是,当我从 View 返回子 TableView 时,选项卡控件已经消失。
如果有人能提供解决此问题的方法,我将不胜感激。我们的想法是能够返回到详细信息 TableView ,而无需转到 Root View ,因为我已经尝试过这一点,并直接将我带到第一个选项卡而不是详细信息 TableView 。
另一件事,如果这需要代码,如果提供的代码是 swift,我也会很感激。
下面是从 UITableViewRowAction 调用 View 的代码:
var details = UITableViewRowAction(style: .Normal, title: "Edit") {
(action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
let destination = self.storyboard?.instantiateViewControllerWithIdentifier("editFolder") as! EditFolderViewController
self.showDetailViewController(destination, sender: self)
}
为了返回 TableView ,我使用在 Storyboard 中创建的 Segue,因此没有代码。
最佳答案
由于您没有展示如何关闭 EditFolderViewController,我只能猜测您如何在 Storyboard中连接 segue。
当您使用 showDetailViewController 时,您将从 EditFolderViewController 获得本质上的模态视图,这就是您想要的吗?
为了关闭 viewController,我建议尝试调用
self.dismissViewControllerAnimated(true, completion: {
//do stuff after view is off screen
})
在 EditFolderViewController 中触发转场的位置。
如果您不想这样做,可以尝试在 Storyboard中设置unwind segue
操作。 Here is a tutorial如果您不熟悉的话,它会引导您完成。
关于swift - 以编程方式调用 View 后选项卡栏消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31976257/