【问题标题】:Open a new TabBarController on clicking a tableview cell in swift在 swift 中单击 tableview 单元格时打开一个新的 TabBarController
【发布时间】:2016-03-17 11:05:27
【问题描述】:

我是 Swift 新手,如何在单击 tableviewcell 时打开新的 TabBarController。等待您的回复

【问题讨论】:

  • 如果您使用情节提要,只需将 segue 从其自身的单元格拖放到新创建的 TabBarController。

标签: ios swift uitableview uitabbarcontroller segue


【解决方案1】:

您有许多好的解决方案: 1) 如果您使用情节提要,然后从单元格中控制并拖动到您的TabBarController。 2) 如果你想用代码来做并且你正在使用UINavigationController尝试通过推送到导航来做到这一点:

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

【讨论】:

  • 感谢 Dragos 的解决方案,对我帮助很大
  • 很高兴听到这个消息:-)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多