From 26f9d868002eed84ab0f9a13ca51ba6ab630f765 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 13 May 2016 12:54:05 -0400 Subject: [PATCH] Fixed Page 3's weird issues. We're so close to having this *just working*! --- darwin/box.m | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/darwin/box.m b/darwin/box.m index ece63679..5a35ff04 100644 --- a/darwin/box.m +++ b/darwin/box.m @@ -161,7 +161,6 @@ struct uiBox { CGFloat padding; NSView *prev; NSLayoutConstraint *c; - NSLayoutRelation relation; BOOL (*hugsSecondary)(uiDarwinControl *); [self removeOurConstraints]; @@ -213,14 +212,22 @@ struct uiBox { @"uiBox secondary start constraint"); [self addConstraint:c]; [self->otherConstraints addObject:c]; - relation = NSLayoutRelationLessThanOrEqual; - if ((*hugsSecondary)(uiDarwinControl(bc.c))) - relation = NSLayoutRelationEqual; c = mkConstraint([bc view], self->secondaryEnd, - relation, + NSLayoutRelationLessThanOrEqual, self, self->secondaryEnd, 1, 0, - @"uiBox secondary end constraint"); + @"uiBox secondary end <= constraint"); + if ((*hugsSecondary)(uiDarwinControl(bc.c))) + [c setPriority:NSLayoutPriorityDefaultLow]; + [self addConstraint:c]; + [self->otherConstraints addObject:c]; + c = mkConstraint([bc view], self->secondaryEnd, + NSLayoutRelationEqual, + self, self->secondaryEnd, + 1, 0, + @"uiBox secondary end == constraint"); + if (!(*hugsSecondary)(uiDarwinControl(bc.c))) + [c setPriority:NSLayoutPriorityDefaultLow]; [self addConstraint:c]; [self->otherConstraints addObject:c]; }