text size in label

前端 未结 1 935
孤独总比滥情好
孤独总比滥情好 2021-01-28 06:30

how can i limit the number of characters in a label

相关标签:
1条回答
  • 2021-01-28 06:55

    You can truncate the text with an ellipsis automatically by setting the frame of the UILabel.

    NSInteger newSize = 10;
    label.frame = CGRectMake(label.frame.origin.x, label.frame.origin.y, label.frame.size.height,  newSize);
    
    0 讨论(0)
提交回复
热议问题