Search code examples
iosiphoneswiftautolayout

How to move view up when there is no ImageView?


screenshot

I am having a problem while designing a view through Storyboard in iOS. I have added 2 Image Views to my view and a Label below them. But when there is no image, I have called the isHidden() method to each ImageViews, that should make Label to move up. Right?

But the Label is not moving up when I call it and it is showing an empty space as there is no image.

Can you tell me how can I fix this?

I am using Auto Layout and I have set Label to be below ImageView constraint.


Solution

  • create IBObject of height constraint and instead of

    isHidden()
    

    write

    constraintObject.constant = 0