• 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: 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


  • Follow-Ups:
    • Re: drawing centered text in a box
      • From: "James W. Walker" <email@hidden>
References: 
 >drawing centered text in a box (From: "James W. Walker" <email@hidden>)

  • Prev by Date: Can I use tool tips with images?
  • Next by Date: File icons shown upside down in the Open Recent menu
  • Previous by thread: drawing centered text in a box
  • Next by thread: Re: drawing centered text in a box
  • Index(es):
    • Date
    • Thread