简体   繁体   中英

How to calculate the height of cell with tagViews?

Now, I have one UITableviewCell like this:

|--------------------|
|  TitleLabelxxxxxx  |
|   SubtitleLabelxxx |
| tagView(Labels )   |
|____________________|

Tagview : https://github.com/ElaWorkshop/TagListView

TitleLabel and subtitleLabel are not one line.

I receive data from the backend and set the data to tagViews, titleLabel and subtitleLabel.

I used a storyboard to make this TableviewCell.

I used autoLayout to preset the height of the Tagview.

The value of height is more than or Equal 34( one line height).

If the tagViews has one line label, the TableviewCell renders perfectly.

If the tagViews has several tags:

When the TableviewCell first shows, the TableviewCell does not render all tags which are rendered in the tagView.

When I scroll this tableView, all TableviewCell will render perfectly after they scroll into the screen.

I used the tableView.rowHeight = UITableView.automaticDimension to set the height of TableviewCell.

This way can't calculate the perfect height value when the cell first renders.

The answer:

https://github.com/ElaWorkshop/TagListView/issues/191

I used this way to fix the bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM