【发布时间】:2016-10-01 21:01:42
【问题描述】:
我正在尝试改变这一点:
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'
我已经搜索了一整天,但找不到解决方案。
【问题讨论】:
标签: nspredicate swift3 uicollectionviewlayout