我是Swift的新手,如何在单击tableviewcell时打开新的TabBarController。等待您的回应
最佳答案
您有许多好的解决方案:
1)如果使用情节提要板,请按住Control键并从单元格中将其拖动到TabBarController
。
2)如果您想使用代码来做,并且您正在使用UINavigationController
,请尝试通过推送到Nav来做到这一点:
let VC1 = self.storyboard!.instantiateViewControllerWithIdentifier("MyViewController") as! ViewController
self.navigationController!.pushViewController(VC1, animated: true)
3)如果您没有
UINavigationController
,则可以这样显示VC:let VC1 = ViewController() //change this to your class name
self.presentViewController(VC1, animated: true, completion: nil)
4)如果您使用的是Nibs(之前是次要更改):
ViewController(nibNameOrNil: nil, bundleOrNil: nil)
如果您需要更多资源,可以查看此链接here