Open sergstav opened 6 years ago
You can get the height of taglistview from tagListView.intrinsicContentSize.height.
@Hira-shrestha intrinsicContentSize.height return's wrong height for me, for example if i have 8 tags and 21 taglistview height, and some margins, then I get 196
@sergstav
intrinsicContentSize.height return's wrong height for me, for example if i have 8 tags and 21 taglistview height, and some margins, then I get 196
what's the expected value?
@anti-transmission When I first load tableview with tags, I have 8 tags in cell and 21 taglistview height, displays as two rows, but intrinsicContentSize.height returns (821) + margins = 196. But expected value I think should be 2(rows) 21. I see that rows property used for count of tags, not actually rows. But, after reload I get correct values, so my question maybe is how to get correct value when I load table, I tried invalidateIntrinsicContentSize() but without success.
it will be easier to debug if you attach a project.
if appeal.labels.count > 0 {
lastMessageLabel.snp.removeConstraints()
lastMessageLabel.snp.makeConstraints { (make) in
make.top.equalTo(subjectLabel.snp.bottom).offset(3)
make.left.equalToSuperview().offset(43)
make.bottom.equalTo(tagListView.snp.top).offset(-7)
}
tagListView.snp.removeConstraints()
tagListView.snp.makeConstraints { (make) in
make.height.equalTo(tagListView.intrinsicContentSize.height)
make.left.equalToSuperview().offset(44)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-17)
}
tagListView.isHidden = false
}
I get the error only when cell loads first, after reload all works as expected.
@anti-transmission some news?
same here, cant get the correct height of tagListView, rows property is actually getting the tags and not the rows.
So who can tell me how to solve it please ....
Hi All, How can i restrict two tags in a row ?
override open var intrinsicContentSize: CGSize {
var height = CGFloat(rows) * (tagViewHeight + marginY)
if rows > 0 {
height -= marginY
}
return CGSize(width: frame.width, height: height)
}
and
private func rearrangeViews() {
...
for (index, tagView) in tagViews.enumerated() {
tagView.frame.size = tagView.intrinsicContentSize
tagViewHeight = tagView.frame.height
...
}
i think if tagViewHeight is diffrent in rowViews. the result is incorrect
Try tagListView.subviews.count
I do not know why this works but, at least in my testing it seems to be equal to the number of rows.
Hello to all, how can I get the number of rows(not tagViews) in the TagListView? I need height of taglistview, but can't get correct value.