cocoa - AutoLayout SubViews alignment to superview's center X -
how subviews alignment superview's center x?
i have 2 subviews added resizing able superview. subviewa want trailing alignment superview's center x , subviewb want leading superview's center x.
as situation how can do?
thanks
you can try add constraints following patterns (nslayoutconstraint class reference):
[superview addconstraint:[nslayoutconstraint constraintwithitem:subviewa attribute:nslayoutattributetrailing relatedby:nslayoutrelationequal toitem:superview attribute:nslayoutattributecenterx multiplier:1.0 constant:0.0]]; [superview addconstraint:[nslayoutconstraint constraintwithitem:subviewb attribute:nslayoutattributeleading relatedby:nslayoutrelationequal toitem:superview attribute:nslayoutattributecenterx multiplier:1.0 constant:0.0]];
Comments
Post a Comment