ios - Proportional distance constraints in auto layout -
i not able achieve desired layout of views auto layout in >ios6.
i have uiview1 , uiview3 fixed parent view (correspondingly topspacetosuperview, bottomspacetosuperview , fixedheight) , behave expected when parent view changes height.
which constraints should specify in ib uiview2 if want maintain same proportional distance siblings (uiview1 , uiview3) when parent view changes height? (as displayed in image)
the way use invisible "spacer" views between views.
you can't have relatively sized spaces use these views instead.
where current spaces place uiview in each.
then (in code can't in ib) set height constraint between these correct multiplier want.
i.e.
[nslayoutconstraint constraintwithitem1:spacer2 attribute:nslayoutattributeheight relation:nslayoutrelationequal item2:spacer1 attribute:nslayoutattributeheight multiplier:0.5 constant:0];
then make other views "stick" above , below these spacer views 0 spacing.
then have hide these views , auto layout take care of rest.
Comments
Post a Comment