2017-06-16 53 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应该工作。

错误很可能是因为缺少其他功能,所以此解决方案应该工作。

相关问题