override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let cell = sender as! CateCollectionViewCell
let indexPath = self.collectionView!.indexPathForCell(cell)
var vc = segue.destinationViewController as! PostQuestionViewController
vc.cate = data[indexPath.row]
}
let indexPath = self.collectionView!.indexPathForCell(cell) 提示报错
Cannot invoke 'indexPathForCell' with argument list of type '(CateCollectionViewCell)'
CateCollectionViewCell是我自己创建的一个UICollectionViewCell
1
daiyuechuan OP 找到问题了
不能在UIViewController里直接这样来写,需要把控制器更改为UICollectionViewController |