Please take a look at the beneath image of my storyboard to grasp the format of my views.
On the left aspect is a horizontal UIStackView
with 2 buttons. That is okay.
On the precise aspect of the above stack view is a UIScrollView
which has a horizontal UIStackView
inside it.
I mainly need the precise stack view to have the ability to have many buttons in it.
If the precise stack view’s measurement exceeds the scroll view’s width, then it ought to be scrollable to point out remaining buttons.
This works advantageous to this point and I used to be in a position to obtain this by setting the precise stack view’s edges to the contentLayoutGuide
of the mum or dad scroll view and setting the precise stack view’s peak equal to the frameLayoutGuide
of the mum or dad scroll view.
This permits me to scroll efficiently if there are too many buttons.
The issue I’m dealing with is that if there’s only some buttons to not be sufficient to be scrollable, then I would like these buttons to be proper aligned. Principally, the UIScrollView
ought to align the content material stack view on the precise aspect. At present, all buttons are aligned to the left aspect.
I would like it to seem like this: