2016-09-22 45 views
1

我想我的项目转换为快捷3,但让我的代码以下错误:不能调用价值的非功能类型斯威夫特3

代码:

super.collectionView(collectionView, willDisplayCell: cell, forItemAtIndexPath: indexPath) 

错误:

不能调用非功能类型'uicollectionview'的值

有没有人知道swift 3编辑?

回答

0

如果你继承一个UICollectionViewController你应该能够使用此:

override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { 
    super.collectionView(collectionView, willDisplay: cell, forItemAt: indexPath) 
} 

如果不继承一个UICollectionViewController你可能将不得不使用:

@objc(collectionView:willDisplayCell:forItemAtIndexPath:) func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { 

} 

我都我已更新的应用中的收集视图类型,这对我来说很有用。