Swift2 UICollectionView中xib的静态单元格,带分段(Swift 2)

Swift2 UICollectionView中xib的静态单元格,带分段(Swift 2),swift2,uicollectionview,xcode7,xib,uicollectionviewcell,Swift2,Uicollectionview,Xcode7,Xib,Uicollectionviewcell,我想使用UICollectionView创建行列表,每行都可以单击并转到另一个控制器。 我在xib中创建自定义单元格并为其创建类 这是我的代码: class CollectionCellXIB: UICollectionViewCell { @IBOutlet weak var label: UILabel! required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override func

我想使用UICollectionView创建行列表,每行都可以单击并转到另一个控制器。 我在xib中创建自定义单元格并为其创建类

这是我的代码:

class CollectionCellXIB: UICollectionViewCell {

@IBOutlet weak var label: UILabel!

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
}

override func awakeFromNib() {
    super.awakeFromNib()
}
}


class Collection: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {

@IBOutlet weak var collectionView: UICollectionView!


func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return 2
}

func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    return 1
}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    var cell: CollectionCellXIB
    self.collectionView!.registerNib(UINib(nibName: "CollectionCellXIB", bundle: nil), forCellWithReuseIdentifier: "cell")

    if indexPath.row == 0 {
         cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! CollectionCellXIB
         cell.label.text = "cell 1"
    } else {
        cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! CollectionCellXIB
        cell.label.text = "cell 2"
    }

    return cell
}
}

不幸的是,分段不起作用。当我点击一行时,什么也没发生。未调用shouldPerformSegueWithIdentifier方法

所以,问题是,如何将自定义单元格与xib结合使用并使用segues