NSStringDrawing
NSStringDrawing
- Subject: NSStringDrawing
- From: MF <email@hidden>
- Date: Thu, 14 Aug 2008 17:31:41 +0200
Hello!
I tried to draw strings in the center of a rectangle. While it's alright to
execute the code, and the font is correctly shown, the alignment is wrong.
(still on the left side...)
the following is the codes for drawing the string. Does anyone know what's
wrong with it? or simply drawing string doesn't support alignment?
NSFont *font = [[[NSFont fontWithName:@"Verdana" size:12.0] retain]
autorelease];
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
[style setAlignment:NSCenterTextAlignment];
NSDictionary *attrsDictionary =
[NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName,
style,NSFontAttributeName,nil];
[style release];
[name drawInRect:aRect withAttributes:attrsDictionary];
Thanks a lot!
_______________________________________________
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