2017-06-16 50 views
-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中它的超類中的任何方法?

方法不重寫它的超類中的任何方法。

我該如何解決問題。

任何人都可以請你幫我。

在此先感謝。

+0

這更多的是關於蘋果的框架而不是Swift:你從哪個類繼承而來?這是在iOS,macOS ...?也許在超類中沒有這種重寫方法,或者方法可能改變了它的名字/簽名。無論哪種方式,查看超類的文檔將給出解決方案(刪除覆蓋只會創建一個沒有用的方法)。 – Moritz

+0

你確定,你試圖在layoutAttributesClass的實例內做到這一點? –

回答

-2

嘗試刪除override應該工作。

錯誤很可能是因爲缺少其他功能,所以此解決方案應該工作。

相關問題