Re: drawing centered text in a box
Re: drawing centered text in a box
- Subject: Re: drawing centered text in a box
- From: Ricky Sharp <email@hidden>
- Date: Sat, 11 Oct 2008 12:00:37 -0500
On Oct 11, 2008, at 11:27 AM, James W. Walker wrote:
When using the NSString or NSAttributedString methods for drawing
text in a box, such as -[NSAttributedString drawWithRect:options:],
is there any way to make the lines of text horizontally centered?
Yes. Create a dictionary with a key of NSParagraphStyleAttributeName
and a value of a NSParagraphStyle instance with your alignment and
potentially other attributes. When creating an instance of
NSAttributedString you can use that dictionary for its attributes.
Or, use the dictionary with NSString's drawInRect:withAttributes: or
drawWithRect:options:attributes:
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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