uilabel tail truncation

后端 未结 4 1445
慢半拍i
慢半拍i 2020-11-30 14:06

Im working on an ios app using objective c and i have an issue with uilabel that i could use some help with. Basically i have a label that can change size to fit the text th

4条回答
  •  孤街浪徒
    2020-11-30 14:55

    lineBreakMode is a switch. It can be either (for iOS6+) NSLineBreakByWordWrapping or NSLineBreakByTruncatingTail but not both.

    But, to answer your question, you can find the size of some text using the class extensions in NSString+UIKit. Having found the size you could update the frame of the UILabel appropriately.

提交回复
热议问题