0

I have a horizontal ScrollView of 20 (110 * 130 point) UIViews contained within a StackView. Each UIView contains an image.

When certain UIViews are hidden the UIView width is maintained at 110points. However, spaces are left were the hidden UIView should be.

I have been practicing with a StackView of 3 UIViews and hiding the center UIView. This leaves a space in the middle... I would like the 3rd UIView to move into the 2nd UIView position (middle) and perform this for subsequent UIViews later on.

Does anyone know how I could go about doing this? Is this even possible?

I was hoping to accomplish this with a UICollectionView, however, I don't think you can drag an image from UICollectionView to UIView

Drag and Drop Image from UICollectionView to UIView?

Community
  • 1
  • 1
M.Strachan
  • 135
  • 2
  • 13

1 Answers1

0

A storyboard isn't meant for these complex user interactions, so I recommend you programmatically create your stack view and then set its constraints programmatically as well. This let's you change elements' heights in your code easily. This might help you get started: Add views in UIStackView programmatically

Community
  • 1
  • 1
Saoud Rizwan
  • 629
  • 10
  • 20