I've got a custom view called SequenceView in a NSScrollView.
It should draw 20 red rectangles in a column.
The problem : the rectangles are damaged/not drawn/drawn partially upon vertical scrolling.
Before and after the scroll:
- (void)drawRect:(NSRect)rect {
[[NSColor yellowColor] set];
NSRectFill(_bounds);
[[NSColor redColor] set];
NSLog(@"Rect: %@", NSStringFromRect(rect));
float x = rect.origin.x+10;
float y = rect.origin.y+10;
for (unsigned i=0; i<20; i++) {
NSRect r = NSMakeRect(x,y,30, 30);
if (NSIntersectsRect(r, rect)){
NSLog(@"Drawing: %@", NSStringFromRect(r));
[[NSBezierPath bezierPathWithRect: r] stroke];
}
y+=40;
}
}