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