Workaround for status collapse button overlapping other views in the cell
This commit is contained in:
parent
105a01811a
commit
3109aafd20
|
@ -125,7 +125,19 @@ extension StatusCollectionViewCell {
|
||||||
statusState.collapsed = false
|
statusState.collapsed = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
collapseButton.isHidden = !statusState.collapsible!
|
let expected = !statusState.collapsible!
|
||||||
|
// Very very rarely, setting isHidden to false only seems to partially take effect:
|
||||||
|
// the button will be rendered, but isHidden will still return true, and the
|
||||||
|
// containing stack view won't have updated constraints for it and so the cell
|
||||||
|
// layout will be wrong and the button will overlap other views in the stack.
|
||||||
|
// So, as a truly cursed workaround, just try a few times in a row until reading
|
||||||
|
// back isHidden returns the correct value.
|
||||||
|
for _ in 0..<5 {
|
||||||
|
collapseButton.isHidden = expected
|
||||||
|
if collapseButton.isHidden == expected {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
contentContainer.setCollapsed(statusState.collapsed!)
|
contentContainer.setCollapsed(statusState.collapsed!)
|
||||||
if statusState.collapsed! {
|
if statusState.collapsed! {
|
||||||
contentContainer.alpha = 0
|
contentContainer.alpha = 0
|
||||||
|
|
Loading…
Reference in New Issue