• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: drawing centered text in a box
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing centered text in a box


  • Subject: Re: drawing centered text in a box
  • From: "James W. Walker" <email@hidden>
  • Date: Sat, 11 Oct 2008 14:33:02 -0700


On Oct 11, 2008, at 10:00 AM, Ricky Sharp wrote:


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:

Thanks!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >drawing centered text in a box (From: "James W. Walker" <email@hidden>)
 >Re: drawing centered text in a box (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Re: Matrix of Controls
  • Next by Date: Re: NSNull and @""
  • Previous by thread: Re: drawing centered text in a box
  • Next by thread: Can I use tool tips with images?
  • Index(es):
    • Date
    • Thread