2

I have a UILabel that has static 3 lines. Also it's lineBreakMode is NSLineBreakByTruncatingTail.

So if there are the long text that contains over 3 lines, the label will show "..." in the tails.

How can I get the last character or index before "..."? For example:

"There are the long long
long long long long long
long long long words ..."

I want to know the "s" index.

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
ZZB
  • 21
  • 4
  • possible duplicate of [How do I locate the CGRect for a substring of text in a UILabel?](http://stackoverflow.com/questions/19417776/how-do-i-locate-the-cgrect-for-a-substring-of-text-in-a-uilabel) – Kumar KL Mar 18 '14 at 12:31
  • http://stackoverflow.com/questions/19417776/how-do-i-locate-the-cgrect-for-a-substring-of-text-in-a-uilabel – Kumar KL Mar 18 '14 at 12:31
  • 1
    Maybe this can help: [UILabel visible part of text](http://stackoverflow.com/questions/4100421/uilabel-visible-part-of-text). This returns `NSRange` of `NSString` that is shown before truncation. Just take the `length` value from range, that gives you the last character to be displayed before `...`. – Amar Mar 18 '14 at 12:41
  • @Amar Your comment helps a lot! Thanks! – ZZB Mar 18 '14 at 15:39

0 Answers0