I have a view which has many subview. Height of view is depend upon height of subViews.But in a case I want view to be of height 0 regardless of its subView height. I to achieve that.
for example there is a view called view and it has 2 subView(image and label) view1 and view2.
constraint are like this.
view1.top = view.top + 1
view1.height = 30
view2.top = view1.bottom
view.bottom = view2.bottom.
I think what you're are looking for is the heightAnchor.
https://developer.apple.com/reference/uikit/uiview/1622590-heightanchor
view.heightAnchor.constraint(equalToConstant: 0).isActive = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With