Idea is to have a stack view of button aligned horizontally or vertically as per specification. Follow below steps: Construct mainStackview for UIImageButton rootStackView contains series of buttons. ( like $,$$, $$$, etc.. ) Pin both mainStackView & rootStackView inside the UIView to establish corner radius functionality. Have key variables like widthConstraint, buttonsAreHidden ,updateButtonImage. These variables values will be altered during expanding /unexpanding the buttons via didSet