0

I am making a custom cell using auto layout, but the auto layout is not applied well.

enter image description here

I set auto layout like this Then, in the end, this shape come out. but this shape that The ratio is not right. why it doesn't match..? i set a autolayout on storyboard...

enter image description here

As far as I know, if the image view in the stack view becomes hidden, the unhidden image view is filled in the rest of the stack view space. is it right? if it's right. I make the code

if imageView == nil{

      imageView.isHidden = true }
ga-yo
  • 123
  • 1
  • 2
  • 11
  • Do you want the single image on the right to be at the same place if you have all 4 images? Or do you want it centered vertically? – DonMag Aug 28 '20 at 19:42
  • 1
    To clarify... do you want it to look like this: https://i.stack.imgur.com/0Qibs.png or this: https://i.stack.imgur.com/NeLar.png – DonMag Aug 28 '20 at 20:10
  • I want to second look like this – ga-yo Aug 29 '20 at 06:17
  • If I upload 4 images If all 4 images are included, it will be correct shape.. – ga-yo Aug 29 '20 at 06:21

1 Answers1

1

I'm going to guess at some of your constraints...

Here's my example layout:

enter image description here

The "Diamond" image view positions are:

1    3

2    4

Both Vertical stack views (V-Stack-Left and V-Stack-Right) have the same settings:

enter image description here


If we set Alignment: Center for the Horizontal stack view (H-Stack):

enter image description here

Setting diamond4.isHidden = true gives this result:

enter image description here


If we set Alignment: Top for the Horizontal stack view (H-Stack):

enter image description here

Setting diamond4.isHidden = true gives this result:

enter image description here

DonMag
  • 69,424
  • 5
  • 50
  • 86