I have a stack with 2 view inside it, the yellow takes up 70% of the stack and the green the other 30%. I want to code a button that will upon click:
myStack.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
I have done the 70:30 thing with "equal widths constraint like so: widths
How may I achieve this functionality and what is the code of resetting everything back to normal? desired output
Fill Proportionally
.0.7 of superview.width
for first & 0.3 of superview.width
for second).firstView.isHidden = true
, it will automatically stretch the secondView to cover stackView in full - Expanded state.firstView.isHidden = false
, it will bring you back to Initial state.