I wanna display two UILabels(Title, Subtitle) in a cell.
for Title: multiple line > 0
for Subtitle: 0 ≤ multiple line ≤ 2
A bug here(say, title&subtitle are both 2 lines, cell's indexPath.row = 1):
The first time I run the simulator, title only shows 1 line and subtitle shows 2 lines. After I scrolled the tableView and back to the first indexPath.row, it display correctly! It seems like this:
First time:
—————————————————
This is the tile, and it should display...
This is the subtitle, and it should show
2 rows.
—————————————————
After scroll and back to this cell:
—————————————————
This is the title, and it should display
two rows.
This is the subtitle, and it should show
2 rows.
—————————————————
What I've done:
In controller: tableView.estimatdRowHeight = 79
tableView.rowHeight = UITableViewAutomaticDimension
In storyboard:
For title:
- Leading space to superview
- Trailing space to superview
- Top space to Superview
- Align leading to Subtitle
- Align trailing to Subtitle
- Bottom space to Subtitle
For subtitle:
- Bottom space to superview
- Align Leading to Title
- Align trailing to Title
- Top space to Title
I'm confused for this bug several days, any ideas to solve this? Big thanks!!!(Sorry for lacking image cuz I don't get enough reputation ><)