Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Xcode-UICollectionView应选择vs didSelect_Ios_Xcode_Swift_Uicollectionview - Fatal编程技术网

Ios Xcode-UICollectionView应选择vs didSelect

Ios Xcode-UICollectionView应选择vs didSelect,ios,xcode,swift,uicollectionview,Ios,Xcode,Swift,Uicollectionview,函数shouldSelectItemAtIndexPath的工作方式与DidDecelectItemAtIndexPath的工作方式完全相同。DidDextIndexPath以随机方式处理某些单元格,而不是另一个单元格。那么这里的问题是什么 编辑:这是一个输入错误,我用了DidDescelectItemAtIndexPath而不是didSelectItemAtIndexPath也许是因为你用了DidDescelect而不是DidSelecte?编码最糟糕的感觉是当你觉得自己很愚蠢的时候:我们都去

函数shouldSelectItemAtIndexPath的工作方式与DidDecelectItemAtIndexPath的工作方式完全相同。DidDextIndexPath以随机方式处理某些单元格,而不是另一个单元格。那么这里的问题是什么


编辑:这是一个输入错误,我用了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) {


    }