Remove white Space after hide views in scrollview?

Viewed 1678

I have UIScrollview with dynamic views(Label, Imageview) inside it. I hide some views but white blank space is there. how can I remove it?

I tried with below code but it doesn't work,

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:myView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];

The layout of File Like:

-View

 -ScrollView

  -UIImageView

  -UIButton

  -UIButton

  -UILable

  -UILable

  -UIButton

  -UILable

  -UILable
1 Answers
Related