How to draw NSString with centered alignment?
How to draw NSString with centered alignment?
- Subject: How to draw NSString with centered alignment?
- From: "Joe Goh" <email@hidden>
- Date: Tue, 23 Jan 2007 13:02:20 +0800
Heya everyone,
I'm having trouble figuring out how to draw an NSString with centered
alignment, given an NSPoint. My approach now is to use a paragraph
style, but that isn't working at all.
Here's what i'm trying now:
------CODE SNIPPET-------------------
NSMutableParagraphStyle *paragraphStyle = [[[NSMutableParagraphStyle
alloc] init] autorelease];
[paragraphStyle setAlignment:NSCenterTextAlignment];
NSDictionary *attributes = [NSDictionary
dictionaryWithObjectsAndKeys:paragraphStyle,
NSParagraphStyleAttributeName, nil];
[someString drawAtPoint:NSMakePoint(x, y) withAttributes:attributes];
------END CODE SNIPPET---------------
Thanks!
Joe Goh
FunkeeMonk Technology
http://www.funkeemonk.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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