Creating a dynamic horizontal view with static-width child views

Viewed 56

I've spent days trying to get this to work, but nothing seems to be going right.

What I'm trying to do is basically recreate this view (NOT the functionality):

enter image description here

However, I have a few extra requirements that I've set for myself. When the user moves their finger over one of the emojis, it should do two things:

  1. Scale the emoji x2
  2. Push the two emojis on either side further out

I don't need help with the above, I just wanted to explain what I want this view to do.

What I need help with is how I should put this view together.

I've tried using a Stack View, which I thought would work, but it doesn't seem to work very well with child views that have static widths (I want each emoji to be 32px wide and tall).

Then, after I put the stack view together, I implemented the scale x2 effect, which worked great, but then I had issues trying to push the two emojis on either side further out. I discovered setCustomSpacing, but this never worked no matter what I tried, and I have a feeling it's because I need my stack view's width to be dynamic (in order to add new emojis and remove old ones at will). The spacing never changed.

So I'm asking how you think I should put this view together? Should I stick with stack view? Why can't I get it to work? Or should I use a different view hierarchy altogether?

0 Answers
Related