Question

I have a UITableView and I'm having trouble with the formatting of the cells.

This is what it looks like this: "Image Link"

As you can see, the cells with a percent grade have the textLabel (the class name) higher than the cells without the percent grade. The problem is in the cellForRowAtIndexPath method in the UITableViewDelegate. I set the text of the textLabel (the part of the table view with the class name) and then if the detailTextLabel has a percent, I set the cell.detailTextLabel.numberOfLines = 2;. I don't see why this affects the textLabel though. I thought the two labels in the content view were independent of each other.

How would I fix this problem and get my labels to format correctly?

Was it helpful?

Solution

You can solve this problem by adding two separate new labels in your cell. Don't use the default labels. You can refer to this link for code snippet and for more detailed explanation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top