Reputation: 53
I'm trying to build a menu like this with Xcode 13 Swift 5.
Each item has different width, but the margin between two items are always the same. Additionally, the highlighting is also dynamic to text width. There will also views attached to each selected item.
Would it be possible to achieve it with UISegmentedControl?
thanks!
Upvotes: 1
Views: 75
Reputation: 14417
You can achieve this using UIStackview
.
Look at the configuration that I have developed for you. Selected font color of the button is white and background color black otherwise font color black and bg blue. On selecting any button deselect the previous one, and boom: achieved.
Upvotes: 1