Tamarisk
Tamarisk

Reputation: 939

Bottom of text cut off in detailTextLabel

I have a tableView with the bottom of low hanging characters (g, p, q, etc) in detailTextView being cut off. Changing the font size and cell height doesn't seem to fix the problem. I can't set values of the cells labels so I am out of ideas. Any help?

Here is a pic of an example.

enter image description here EDIT: I found that using fontawesome is what is causing this. I have no idea why fontawesome is doing this but removing this line of code in my cellForRowAtIndexPath removes the problem

cell.detailTextLabel!.font = UIFont(name: "FontAwesome", size: 16)

Now I have no idea why changing the font is causing this issue, nor how to fix it.

Upvotes: 1

Views: 752

Answers (1)

joern
joern

Reputation: 27620

You have to add these two lines of code to your UITableView set up:

tableView.rowHeight = UITableViewAutomaticDimension // 1
tableView.estimatedRowHeight = 50 // 2

// 1 This tells the UITableView that its cells should be as height as their content

// 2 This is needed by the UITableView to calculate its scroll bar height and position. This value does not have to be 100% correct, an estimation on your average cell height is enough.

Upvotes: 1

Related Questions