You're always setting myRect
to a constant value inside of drawRect:
. It seems like what you want is to not set myRect
at all in drawRect:
and to draw it with its current value. So something like this:
- (void)drawRect:(NSRect)rect
{
CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSetRGBFillColor(myContext, 1, 0, 0, 1);
CGContextFillRect(myContext, myRect);
NSLog(@"drawRect: called");
}