[英]Open new View Controller by clicking Cell in Table View - Swift iOS
[英]Open a new TabBarController on clicking a tableview cell in swift
我是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)
如果您需要更多資源,可以在此處查看此鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.