当用户选择一个单元格时,如何对 UITabBarController 中的不同选项卡执行转场? [英] How can I perform a segue to a different tab in a UITabBarController when user selects a cell?
问题描述
我在包含事物列表的 UITabBarController
的第一个选项卡中有一个 UITableViewCell
.当用户选择一个单元格时,我希望它转到 UITabBarController
中的不同选项卡.
I have a UITableViewCell
in the 1st tab of a UITabBarController
that contains a list of things. When the user selects a cell, I'd like it to segue to a different tab in the UITabBarController
.
我使用以下代码做到了:
I did it using the following code:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
performSegueWithIdentifier("PerformPlaylistsSegue", sender: self)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
然而,现在问题来了,底部标签栏导航被阻止.
However, then problem is now, the bottom tab bar navigation is blocked.
我发现了以下类似问题:
I've found the following similar issues:
两个帖子都提到切换到不同的标签不是一个好主意.
Both posts have mentioning of it not being a good idea to segue to different tabs.
但是,根据我申请的目的,有什么办法可以强制执行此操作吗?
However, based on the purpose of my application, is there any way to force this to occur?
推荐答案
我决定最好不要弄乱 Xcode 并将我的 UITableView
放在 ViewController 中是,而不是处理头痛.
I've decided it's best not to mess with mother Xcode and put my UITableView
in the ViewController where the segued tab is suppose to be, and not deal with the headache.
这篇关于当用户选择一个单元格时,如何对 UITabBarController 中的不同选项卡执行转场?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!