当用户选择一个单元格时,如何对 UITabBarController 中的不同选项卡执行 segue?
How can I perform a segue to a different tab in a UITabBarController when user selects a cell?
我在 UITabBarController
的第一个选项卡中有一个 UITableViewCell
,其中包含一个列表。当用户选择一个单元格时,我希望它转到 UITabBarController
.
中的另一个选项卡
我用下面的代码做到了:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
performSegueWithIdentifier("PerformPlaylistsSegue", sender: self)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
但是,现在问题来了,底部标签栏导航被屏蔽了。
我发现了以下类似问题:
Tab Bar Controller / Segue Issue
两个帖子都提到了切换到不同的标签不是一个好主意。
但是,根据我的应用程序的目的,有什么办法可以强制发生这种情况吗?
我决定最好不要惹妈妈 Xcode 并将我的 UITableView
放在 ViewController 应该是 segued 标签的地方,而不是处理头痛。
我在 UITabBarController
的第一个选项卡中有一个 UITableViewCell
,其中包含一个列表。当用户选择一个单元格时,我希望它转到 UITabBarController
.
我用下面的代码做到了:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
performSegueWithIdentifier("PerformPlaylistsSegue", sender: self)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
但是,现在问题来了,底部标签栏导航被屏蔽了。
我发现了以下类似问题:
Tab Bar Controller / Segue Issue
两个帖子都提到了切换到不同的标签不是一个好主意。
但是,根据我的应用程序的目的,有什么办法可以强制发生这种情况吗?
我决定最好不要惹妈妈 Xcode 并将我的 UITableView
放在 ViewController 应该是 segued 标签的地方,而不是处理头痛。