func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath){
if (indexPath.row == 0){
self.performSegueWithIdentifier("showDetail", sender: self)
}
if (indexPath.row == 1){
self.performSegueWithIdentifier("showSoldi", sender: self)
}
}
问题是两个 View Controller 都被调用了。首先是 segue 本身,然后是这段代码。有什么解释吗?
最佳答案
您的 segues 正在触发,因为您已将它们从 Collection View 的单元格连接起来。如果您希望能够从代码中调用您的 segue,请将它们连接到 viewController 顶部的 viewController 图标。
通过这种方式,转场只会在您调用 performSegueWithIdentifier
时触发。
关于ios - 从 collectionview 过渡到多个 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32155727/