IB의 scrollview에서 레이어 체크 마크를 클릭하여 레이어가 백업되도록 설정된 NSScrollView가 있습니다. 그 scrollview 내에서 NSTableView 있습니다. 해당 NSTableView에서 사용자 지정 NSTableRowView 내 열 사이의 구분선에서 세로 빨간색 선을 그릴 수 있습니다. 내 NSTableView에는 2 개의 열이 있습니다. 내 스크롤 뷰를 레이어 백업으로 설정하면 열 구분선을 드래그하여 열을 넓게 또는 좁게 만들 때마다 drawBackgroundInRect가 호출되지 않기 때문에 드래그 작업 중에 백그라운드 세로선이 업데이트되지 않습니다.레이어 백 뷰에서 drawBackgroundInRect가 호출되지 않습니다.
해결 방법이 있습니까? 여기
- (void)drawBackgroundInRect:(NSRect)dirtyRect {
[super drawBackgroundInRect:dirtyRect];
NSGraphicsContext *nscontext = [NSGraphicsContext currentContext];
[nscontext saveGraphicsState];
CGContextRef context = (CGContextRef)[nscontext graphicsPort];
if (!self.isGroupRowStyle) {
CGRect leftColumnRect = [(NSView *)[self viewAtColumn:0] frame];
leftColumnRect.origin.y -= 1.0;
leftColumnRect.size.height += 2.0;
leftColumnRect.size.width += 1.0;
// grey background
CGContextSetGrayFillColor(context, 0.98, 1.0);
CGContextFillRect(context, leftColumnRect);
// draw nice red vertical line
CGContextBeginPath(context);
CGContextSetRGBStrokeColor(context, 0.6, 0.2, 0.2, 0.3);
CGContextMoveToPoint(context, leftColumnRect.size.width + 1.5, 0);
CGContextSetLineWidth(context, 1.0);
CGContextAddLineToPoint(context, leftColumnRect.size.width + 1.5, leftColumnRect.size.height);
CGContextStrokePath(context);
}
[nscontext restoreGraphicsState];
}
가 열 크기 조정 때 내가 갖는 문제이다 : 여기
내가 drawBackgroundInRect에서 사용하고 코드의
을 그리고 이것은이 보일 것입니다 것입니다 내 스크롤 뷰가 레이어 백업으로 설정되어 있지 않은 경우와 같습니다.
감사!