0

I have such layout with two buttons. When I click on Button 1 it has to disappear and Button 2 has to be moved to center of layout. How can I perform this properly?

enter image description here

Alexander
  • 161
  • 2
  • 14

2 Answers2

2

You can do it with StackView.set StackView center horizotal and vertical alignment and also set in StackView attributes inspector set alignment center and distribution Equal centering. Set both button width fixed.

Donal
  • 6,082
  • 2
  • 19
  • 30
1

Use StackView. You don't have to think about any layout constraint.That is center aligned. When you hide something from stackView it will automatically get centered according to your need.

elk_cloner
  • 2,049
  • 1
  • 12
  • 13
  • Try this link.It's a nice tutorial. https://www.raywenderlich.com/114552/uistackview-tutorial-introducing-stack-views – elk_cloner May 23 '17 at 09:57