NSView drawing with superimposed text
NSView drawing with superimposed text
- Subject: NSView drawing with superimposed text
- From: Michael McLaughlin <email@hidden>
- Date: Sun, 2 Jan 2011 13:36:01 -0500
With Xcode 3.2.5 and the corresponding IB, I have a custom NSView into which I want to draw. This view has 15 static text views in front of it, in the contentView only, all of which are filled in before the custom drawing and none of which draw their own backgrounds. The code for the custom drawing is
-(void)drawRect:(NSRect)rect
{
[[NSColor blackColor] setStroke];
[[NSColor whiteColor] setFill];
[NSBezierPath fillRect:rect];
if (phase3) { // draw line
NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(0, 0)];
[path lineToPoint:NSMakePoint(520, 240)];
[path stroke];
}
}
This method is called three times during a complete rendering.
Without the conditional (if statement), the result is as expected but, with it, the final (third) call to this method references a rect that does not correspond to anything in the window and the final window shows only a small portion of the line even though all of the superimposed text items should be transparent apart from their text.
Obviously, I am missing something important about Cocoa drawing but could find no hints anywhere to help.
Any tips?
TIA.
_______________________________________________
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