我试图在UICollectionView中剪一个洞。
它有效 - 但由于某种原因,它削减了内容\单元格后面的UICollectionView
。我试图删除它,包括内容\ cells。
示例:
代码:
class tCollection : UICollectionView
{
override func drawRect(rect: CGRect) {
super.drawRect(rect)
let holeRect = CGRectMake(20, 20, 50, 60)
var context: CGContextRef = UIGraphicsGetCurrentContext()!
CGContextSetFillColorWithColor(context, UIColor.blackColor().colorWithAlphaComponent(0.5).CGColor)
CGContextFillRect(context, rect)
var holeRectIntersection: CGRect = CGRectIntersection(holeRect, rect)
CGContextSetFillColorWithColor(context, UIColor.clearColor().CGColor)
CGContextSetBlendMode(context, CGBlendMode.Clear)
CGContextFillEllipseInRect(context, holeRect)
}
}
任何建议如何削减一个洞(包括细胞/子视图等等)