Some seemingly odd NSBezierPath behavior.
Some seemingly odd NSBezierPath behavior.
- Subject: Some seemingly odd NSBezierPath behavior.
- From: Cory Knapp <email@hidden>
- Date: Mon, 15 Sep 2003 02:03:38 -0700
I have a chunk of code that generates a NSBezierPath, and this code
works fine when I call it in my view's drawRect: method. However, if I
try to build the path in the init method, it gives me an empty
NSBezierPath. Here is a trimed down example of what I am talking about:
- (id)initWithFrame:(NSRect)frameRect
{
if( self = [super initWithFrame:frameRect])
{
int i, length = [label length];
int vert = 0;
//NSAffineTransform *transform;
titlePath = [[NSBezierPath alloc] init];
for( i = 0; i<length ; i++)
{
NSGlyph theGlyph = [titleFont
_defaultGlyphForChar:[label characterAtIndex:i]];
[titlePath moveToPoint: NSMakePoint(vert,0)];
[titlePath appendBezierPathWithGlyph:theGlyph inFont:
titleFont];
vert += [titleFont advancementForGlyph:theGlyph].width;
}
}
return self;
}
- (void)drawRect:(NSRect)rect
{
[[NSColor blackColor] set];
[titlePath fill];
}
Any ideas?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.