我已经在Xcode 8中将我的项目更新为Swift3,它出现了这个错误,但我不知道我能在那里制作什么。我已经在谷歌搜索但没有创建。 有谁有想法我能做什么?
这里的错误:
方法' collectionViewContentSize()'使用Objective-C选择器' collectionViewContentSize'与getter的冲突为'collectionViewContentSize'来自超类' UICollectionViewLayout'使用相同的Objective-C选择器
public func collectionViewContentSize() -> CGSize {
let numberOfSections = collectionView?.numberOfSections
if numberOfSections == 0 {
return CGSize.zero
}
var contentSize = collectionView?.bounds.size
contentSize?.height = CGFloat(columnHeights[0])
return contentSize!
}
答案 0 :(得分:37)
我有类似的东西,但我重写了collectionViewContentSize()
override func collectionViewContentSize() -> CGSize {
let collection = collectionView!
let width = collection.bounds.size.width
let height = max(posYColumn1, posYColumn2)
return CGSize(width: width, height: height)
}
我今天下载了XCode 8 beta 4,不得不将其更改为:
override var collectionViewContentSize: CGSize {
let collection = collectionView!
let width = collection.bounds.size.width
let height = max(posYColumn1, posYColumn2)
return CGSize(width: width, height: height)
}