我在 NSCollectionView 子类中有以下代码:
-(void)drawRect:(NSRect)rect {
if(!NSEqualRects(highlightBox,NSZeroRect)) {
[[NSColor colorWithCalibratedRed:1.0f green:0.2f blue:0.2f alpha:1.0f] set];
NSRectFillUsingOperation(NSInsetRect(tempHighlightBox, -1.0, -1.0),NSCompositeSourceOver);
[[NSColor colorWithCalibratedRed:0.2f green:0.2f blue:1.0f alpha:0.5f] set];
NSRectFillUsingOperation(tempHighlightBox,NSCompositeSourceOver);
}
}
NSRect 画得很好,但它在任何 NSCollectionViews 子视图后面,我希望它在顶部。这可能吗?