How to hide elements in a Stack View
isHidden property doesn't work, but you can use alpha and achieve the same result,
QBIndicator.alpha = 1.0
will work for QBIndicator.isHidden = false
and
QBIndicator.alpha = 0.0
will work for QBIndicator.isHidden = true
setting a view to hidden should make it no longer visible, regardless of whether or not it inside a UIStackView
.
The benefit of UIStackView
is that it provides free animation through the isHidden property, like so:
// Assuming stackViewSubView.isHidden == false here
UIView.animate(withDuration: 0.25, animations: {
self.stackViewSubView.isHidden = true
self.view.layoutIfNeeded()
})