问题
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:
How can I segue to the second tab of a tab bar controller from the first tab?
Tab Bar Controller / Segue Issue
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?
回答1:
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.
来源:https://stackoverflow.com/questions/35401083/how-can-i-perform-a-segue-to-a-different-tab-in-a-uitabbarcontroller-when-user-s