问题
I am creating a custom UITableViewCell with UILabel inside.
When I am setting too long text into UILabel, it overlaps bounds of the cell. Looks like I have specified all required properties of UILabel, but still failed to resolve what could be wrong.
Possibly I should configure a table or the cell?
Could you please advice the way I can fix this?
Thanks.
回答1:
Have you set the number of lines on the UILabel to greater than 1? The number of lines defaults to 1, and if it is set to 1 then none of the UILineBreakModes will apply.
You can set the number of lines in code as follows:
UILabel *myLabel;
myLabel.numberOfLines = 2;
You should then find your LineBreakMode setting works...
来源:https://stackoverflow.com/questions/1333809/custom-uitableviewcell-failed-to-apply-uilinebreakmodetailtruncation