> On Dec 14, 2016, at 2:46 PM, Ken Thomases <k...@codeweavers.com> wrote: > > On Dec 14, 2016, at 4:19 PM, Doug Hill <cocoa...@breaqz.com> wrote: >> >> I'm seeing warnings in the console when I dynamically make autolayout >> constraints active/inactive at runtime. >> >> I have two constraints that align a container view leading or trailing edge >> with another view's edge. This is to move the container onscreen or >> offscreen. I have another view whose trailing edge aligns with the leading >> edge of the first container view so it moves with it as autolayout >> constraints change. >> >> At runtime, I make one of these constraints active and the other inactive, >> like so: > >> - (IBAction)showComments:(id)sender >> { >> self.showCommentsConstraint.active = YES; >> self.hideCommentsContainerConstraint.active = NO; > > Swap the order of these. Always disable no-longer-applicable constraints > before enabling newly-applicable constraints. The way you have it here, > after the first line, you temporarily have constraints which conflict > enabled. You fix that with the next line, but you've already gotten the > warning by then.
Ding-Ding-Ding-Ding-Ding-Ding! We have a winner! I went ahead and made this change and warnings are gone. Will keep the order of activation in mind for future coding. Doug Hill _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com