0

Let say, I have a horizontal ScrollView of 20 (110 * 130 point) UIViews contained within a StackView. Each UIView will contain an image and a label. If I decide to hide certain UIViews from the StackView it changes/stretches the width of the UIView. How would I be able to maintain the same width/height of the UIView?
So lets say if I decided to hide 19 UIViews contained within the StackView. Is it possible to only show 1 UIView (110 * 130) within the StackView?

I have tested this out using a StackView of 3 UIViews in Storyboard with no success. If I get this to work then my plan is to programmatically code in the 20UIViews.

I would appreciate any help.

M.Strachan
  • 135
  • 2
  • 13

1 Answers1

0

You need to set constraints for the views inside the stack view. So in your case, the width constraint isn't set for the UIViews and is therefore causing weird problems.

I recommend checking out this guide on working with stack views in storyboard : http://www.appcoda.com/stack-views-intro/

Saoud Rizwan
  • 629
  • 10
  • 20
  • Thanks very much. This has worked very well. I have another problem with moving the visible images so that they are side by side. I have raised another question. If you have time to look at. Thanks. http://stackoverflow.com/questions/40659979/move-visible-images-in-stackview-closer-to-leading-space – M.Strachan Nov 17 '16 at 16:23