Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autolayout collapsing space when removing intermediate views

I am a bit stumped as to how to properly define constraints that will collapse the space between views when a given view is removed. I have tried adding vertical constraints with a greater than or equal relation, however, it seems that the min distance to satisfy the constraint is not preferred.

For example, given the following layout with three constraints V:[A]-5-[B], V:[B]-5-[C], and V:[A]-(>=5)-[C]:

[ View A ]
    |
   5 pt
    |
[ View B ]
    |
   5 pt
    |
[ View C ]

After removing view B I want it to look like this:

[ View A ]
    |
   5 pt
    |
[ View C ]

But it looks like this:

[ View A ]
    |
   5 pt + 5 pt + height of view B
    |
[ View C ]
like image 509
Jack Rowlingson Avatar asked Mar 13 '14 16:03

Jack Rowlingson


1 Answers

You could add V:[A]-5-[C] with a lover priority, below 1000.

[superview]
    |
[ View A ]
    |             |
   5 pt (1000)    | 
    |             |
[ View B ]       5 pt (999)
    |             |
   5 pt (1000)    |
    |             |
[ View C ]        
like image 190
MANIAK_dobrii Avatar answered Sep 28 '22 05:09

MANIAK_dobrii