![](/img/trans.png)
[英]How can I Navigate to a viewController from a collectionView's didSelectItemAt which is inside a tableView cell?
[英]How can I do if I want to press a cell from a tableview that opens a collectionview in code?
你應該實施
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.performSegueWithIdentifier("yourIdentifierHereFromStoryboard", sender: yourSender or nil ) }
在 PatientDetailTableViewController 中,您可以實現 tableview 委托的 func:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let collectionView = self.storyboard!.instantiateViewControllerWithIdentifier("CollectionViewController") as! CollectionViewController
self.navigationController?.pushViewController(collectionView, animated: true)
}
並在您的故事板中,記住填寫故事板 ID:“CollectionViewController”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.