Ios Xcode-UICollectionView应选择vs didSelect
函数shouldSelectItemAtIndexPath的工作方式与DidDecelectItemAtIndexPath的工作方式完全相同。DidDextIndexPath以随机方式处理某些单元格,而不是另一个单元格。那么这里的问题是什么Ios Xcode-UICollectionView应选择vs didSelect,ios,xcode,swift,uicollectionview,Ios,Xcode,Swift,Uicollectionview,函数shouldSelectItemAtIndexPath的工作方式与DidDecelectItemAtIndexPath的工作方式完全相同。DidDextIndexPath以随机方式处理某些单元格,而不是另一个单元格。那么这里的问题是什么 编辑:这是一个输入错误,我用了DidDescelectItemAtIndexPath而不是didSelectItemAtIndexPath也许是因为你用了DidDescelect而不是DidSelecte?编码最糟糕的感觉是当你觉得自己很愚蠢的时候:我们都去
编辑:这是一个输入错误,我用了DidDescelectItemAtIndexPath而不是didSelectItemAtIndexPath也许是因为你用了DidDescelect而不是DidSelecte?编码最糟糕的感觉是当你觉得自己很愚蠢的时候:我们都去过那里。。。
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let selectedItem = collectionView?.indexPathForCell(sender as UICollectionViewCell) {
if segue.identifier == "next" {
var second: SecondViewController = segue.destinationViewController as SecondViewController
second.itemNumber = selectedItem.row
}
}
}
override func collectionView(collectionView: UICollectionView, shouldSelectItemAtIndexPath indexPath: NSIndexPath) -> Bool {
if let cell = collectionView.cellForItemAtIndexPath(indexPath) {
performSegueWithIdentifier("next", sender: cell)
}
return true
}
override func collectionView(collectionView: UICollectionView, didDeselectItemAtIndexPath indexPath: NSIndexPath) {
}