• 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
NSTextField and NSLineBreakByTruncatingMiddle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextField and NSLineBreakByTruncatingMiddle


  • Subject: NSTextField and NSLineBreakByTruncatingMiddle
  • From: Joshua Scott Emmons <email@hidden>
  • Date: Fri, 20 Jan 2006 21:18:41 -0600

Normally when I know a NSTextField is going to be holding more text than it can display, I set it to wrap and break lines on word boundaries like so:

[[myTextField cell] setWraps:YES];
[[myTextField cell] setLineBreakMode:NSLineBreakByWordWrapping];

It works perfectly.

Today, I started working on an app in which I wanted to break long lines by truncating them in the middle. I thought all I would have to do is:

[[myTextField cell] setWraps:YES];
[[myTextField cell] setLineBreakMode:NSLineBreakByTruncatingMiddle];

Or maybe:

[[myTextField cell] setWraps:NO];
[[myTextField cell] setLineBreakMode:NSLineBreakByTruncatingMiddle];

But neither of these behaves as I would expect. Both prevent the text from wrapping (as the lines are no longer being split on words), but neither does anything to truncate the string. I'm pretty sure NSLineBreakByTruncareingMiddle is supposed to be working in 10.3+, right? I'm working in 10.4, and getting no love. Am I just horribly misusing -setLineBreakMode:?


Cheers, -Joshua Emmons _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSTextField and NSLineBreakByTruncatingMiddle
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Dragging to Folder in Dock
  • Next by Date: Re: drawing and setting pixels
  • Previous by thread: Dragging to Folder in Dock
  • Next by thread: Re: NSTextField and NSLineBreakByTruncatingMiddle
  • Index(es):
    • Date
    • Thread