How can I perform a segue to a different tab in a UITabBarController when user selects a cell? [duplicate]

我只是一个虾纸丫 提交于 2020-01-06 20:10:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!