0
我试图改变这一点:NSPredicate在Swift3
return [self.allAttributes filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UICollectionViewLayoutAttributes *layoutAttributes, NSDictionary *bindings) {
return CGRectIntersectsRect(rect, layoutAttributes.frame);
}]];
到的东西,在swift3工作。到目前为止,我已经试过这样:
return self.allAttributes?.filtered(using: NSPredicate(block: { (layoutAttributes, bindings) -> Bool in
return rect.intersects(layoutAttributes.frame)
})) as! [UICollectionViewLayoutAttributes]?
但当然,我得到Value of type 'Any?' has no member 'frame'
我一直在寻找了一整天,但我不能找到一个解决方案。
它的工作原理。谢谢 – mat