Refreshing an NSView
Refreshing an NSView
- Subject: Refreshing an NSView
- From: Tom Jeffries <email@hidden>
- Date: Wed, 13 Apr 2011 12:23:26 -0700
I seem to be missing something, and it's probably something quite obvious.
In the initialization to an NSView subclass window, I do the following:
- (void) drawRect:(NSRect)dirtyRect
{
[StepWindow DrawStepArea];
}
DrawStepArea is a simple function that draws some lines on the screen-
here's a condensed version:
+ (void) DrawStepArea
{
CGRect stepsBox;
CGContextRef stepsContext = [[NSGraphicsContext currentContext]
graphicsPort];
CGContextSetLineWidth(stepsContext, 1.0);
stepsBox = CGRectMake(0, 0, 100, 100);
CGContextBeginPath (stepsContext);
CGContextSetRGBStrokeColor(stepsContext, 0, 0, 0, 1);
CGContextAddRect(stepsContext, stepsBox);
CGContextFillPath(stepsContext);
CGContextDrawPath (stepsContext, kCGPathStroke);
}
It works perfectly when the window is first initialized. However, when I
call DrawStepArea later nothing gets drawn. I'm calling from another class,
but everything about the call works fine including access to variables in
the StepWindow class.
Any idea what I'm missing, or on what to look for to figure this out? Many
thanks for any suggestions.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden