0

I have a UIView which contains, let's say, 7 objects (UILabel). The size is fixed. In some case, I must hide some of the objects. I do it with setHidden:YES. The problem is that the appearance of the view is not very appealing, because the position of the objects is fixed. It could be better if the objects can freely move up and down when space is available...

gdm
  • 7,647
  • 3
  • 41
  • 71

2 Answers2

0

I found a solution, I am not 100% comfortable with. The technique use a for loop over all the objects/view we want to slide up/down. The solution is here

Community
  • 1
  • 1
gdm
  • 7,647
  • 3
  • 41
  • 71
0

I build category to update constraints easily:

To hide uiview, just do it:

//Hide View
[myView1 setConstraintConstant:0 forAttribute:NSLayoutAttributeHeight];

Answer here: Hide autolayout UIView : How to get existing NSLayoutConstraint to update this one

Community
  • 1
  • 1
Damien Romito
  • 9,801
  • 13
  • 66
  • 84