• 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: Silly NSTextFieldCell tricks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Silly NSTextFieldCell tricks


  • Subject: Re: Silly NSTextFieldCell tricks
  • From: glenn andreas <email@hidden>
  • Date: Thu, 31 Jan 2008 13:55:01 -0600


On Jan 31, 2008, at 1:27 PM, John Stiles wrote:

I've noticed that in table views, the NSTextFieldCell has the ability to ever-so-slightly squash its contents horizontally, to fit inside the table cell, before eventually giving up and truncating them with ellipses.

Is there any way for me to programmatically do the same thing to my own NSTextFieldCell?

As I'm typing this, suddenly I'm thinking "maybe I could fake it by altering the cell's bounds while leaving the frame alone"… but is there a better way? Changing the bounds would make the text thinner, which isn't quite the same as squeezing the letters more tightly together.


With attributed strings, you can set the paragraph style to be one whose setLineBreakMode is one of the three truncation modes (which provides the ellipsis), and use can even use setTighteningFactorForTruncation to adjust how much it tries to reduce the intercharacter spacing before switching to inserting an ellipsis.

You can probably also manually change NSKernAttributeName property of the strings attributes as well.



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next generation of fractal art




_______________________________________________

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: 
 >Silly NSTextFieldCell tricks (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Silly NSTextFieldCell tricks
  • Next by Date: Re: Silly NSTextFieldCell tricks
  • Previous by thread: Re: Silly NSTextFieldCell tricks
  • Next by thread: Help button anchors in IB?
  • Index(es):
    • Date
    • Thread