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 }
这里我收到错误。
Method does not override any method from it's superclass.
如何解决该问题。
谁能帮帮我。
提前致谢。
最佳答案
如果您确实尝试在正确的位置重写该方法,请尝试删除方法名称并输入 override func layoutAttributes
并从自动完成中选择正确的重写。有时会出现此类问题,是因为不同版本的 Swift 的语法发生了变化
关于swift - 方法不会覆盖 Swift3 中其父类(super class)的任何方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44583816/