Truncate UILabel in specific location

后端 未结 3 1316
小蘑菇
小蘑菇 2021-01-20 03:18

I use a table view to show a list of books, where each cell has a UILabel that shows the book\'s name and another UILabel the shows the book\'s aut

3条回答
  •  醉梦人生
    2021-01-20 04:03

    UILabel cannot handle such truncate function other than under iOS 7. either you should truncate the string according to the fixed(calculated with uilabel font size) length yourself but that's a headache, or you can use two UILabels. 1st uilabel with fixed size for first author. it will auto truncate at the end as you know already. then the 2nd uilabel should be drawn exactly on the righ side of first label with of " + 2 other authors".

    Edit: take a look at @Stonz2 answer

提交回复
热议问题