I’m trying to implement a side panel that moves into place horizontally and 
push content over when it is shown. I set up an auto layout constraint so that 
an another view is a fixed number of pixels from the side view. I then want to 
move the origin of the side view and have the other view move with it.

If I set up an alignment constraint so trailing space from my first view to the 
side view is a fixed number of pixels. Let’s say 20 pixels. When I move the 
origin of the side view, the first view doesn’t keep the 20 pixel spacing. In 
fact does nothing.

Looking at the Googles, I see a number of cases where people try to handle this 
situation by doing one of the following:

• Creating another constraint from the first view to the superview margin. They 
then disable to first constraint to side view and and enable the alignment 
constraint to the superview margin.

• Manually change the value of the alignment constraint to the side view.

Neither seem all that satisfactory. I guess I’m wondering why the original 
alignment constraint doesn’t allow for dynamic changes to the view layout. Why 
won’t autolayout cause the views to layout again when views move?
FYI, I tried calling ‘updateConstraintsIfNeeded’ on all these view after 
changing the side view origin and this seems to have no effect.

I also checked Apple’s Autolayout programming guide and didn’t find anything 
that would answer this question. Thanks for any info/pointers about this.

Doug
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to