最佳答案
要为 TableViewController 和 ViewController 创建多个 segue,您需要创建一个从包含 Collection View (而非单元格)的 View Controller 到目标 View Controller 的 segue,例如:
UICollectionViewController -> UIViewController1
UICollectionViewController -> UIViewController2
//...etc
请记住为每个 segue 添加标识符。
并在代码中覆盖UICollectionViewDelegate
方法
collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath)
在该方法中检查哪个单元格被点击(indexPath),如果它是 cell1,则调用带有正确标识符的 segue:
performSegueWithIdentifier("goToVC1Identifier", sender: nil)
关于swift - 创建多个 segue 使用 CollectionView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43403187/