-1
override func layoutAttributesForElements(in rect: CGRect) -> [AnyObject]? {
var layoutAttributes = [UICollectionViewLayoutAttributes]()
// Loop through the cache and look for items in the rect
for attributes in cache {
if attributes.frame.intersects(rect) {
layoutAttributes.append(attributes)
}
}
return layoutAttributes }
這裏我得到的錯誤。方法不覆蓋Swift3中它的超類中的任何方法?
方法不重寫它的超類中的任何方法。
我該如何解決問題。
任何人都可以請你幫我。
在此先感謝。
這更多的是關於蘋果的框架而不是Swift:你從哪個類繼承而來?這是在iOS,macOS ...?也許在超類中沒有這種重寫方法,或者方法可能改變了它的名字/簽名。無論哪種方式,查看超類的文檔將給出解決方案(刪除覆蓋只會創建一個沒有用的方法)。 – Moritz
你確定,你試圖在layoutAttributesClass的實例內做到這一點? –