How to truncate text of UITableViewCellStyleSubtitle cell when 'Delete' slides in?
-
28-10-2019 - |
Question
I have a UITableView
using the UITableViewCellStyleSubtitle
style. I have also increased the cell height by using
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
and then calculating the desired height in heightForRowAtIndexPath
. However, when the user slides the 'delete' button in, the text in the cell stretches out and overlaps the upper and lower edges of the cell. How can I truncate the text like it would if I used the default cell style? (or alternatively, could i change the cell height again possibly?)
Solution
The answer was
cell.textLabel.numberOfLines = textLabelheight/textLabelFontSize;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow