• 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
Any way to determine where a string will be truncated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any way to determine where a string will be truncated?


  • Subject: Any way to determine where a string will be truncated?
  • From: Sixten Otto <email@hidden>
  • Date: Fri, 17 Jan 2014 08:43:37 -0700

Using the methods in the UIStringDrawing category on NSString, it's pretty
straightforward to measure the size of a string as it will appear on
screen, or to draw it into some constrained area. And I love that UIKit
handles all of the logic to truncate the string to fit.

But I find myself in a situation where I'd like to actually obtain the
truncated version of the string. That is, given some text and a bounding
area, to have the system figure out how much will fit, and then tell me
that (whether returning the truncated string directly, or giving me a
character range that would fit, or whatever). So far, though, I can't find
any means to accomplish that.

I feel like I must be missing something obvious, and I'm hoping someone can
point me in the right direction.

Thanks,
Sixten
_______________________________________________

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: Any way to determine where a string will be truncated?
      • From: "T.J. Usiyan" <email@hidden>
  • Prev by Date: PDFDocument, ARC and 10.9 question
  • Next by Date: Re: PDFDocument, ARC and 10.9 question
  • Previous by thread: Re: PDFDocument, ARC and 10.9 question
  • Next by thread: Re: Any way to determine where a string will be truncated?
  • Index(es):
    • Date
    • Thread