More ambiguity debugging hooks.

This commit is contained in:
Pietro Gagliardi 2015-08-03 12:16:08 -04:00
parent c5a013aea1
commit f7c5c6e60e
3 changed files with 10 additions and 8 deletions

View File

@ -120,6 +120,7 @@
[constraint appendString:@"]"]; [constraint appendString:@"]"];
} }
[constraint appendString:@"|"]; [constraint appendString:@"|"];
NSLog(@"%@", constraint);
[self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]]; [self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
// TODO do not release constraint; it's autoreleased? // TODO do not release constraint; it's autoreleased?
@ -131,6 +132,7 @@
constraint = [NSMutableString stringWithString:@"V:|["]; constraint = [NSMutableString stringWithString:@"V:|["];
[constraint appendString:tAutoLayoutKey(i)]; [constraint appendString:tAutoLayoutKey(i)];
[constraint appendString:@"]|"]; [constraint appendString:@"]|"];
NSLog(@"%@", constraint);
[self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]]; [self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
// TODO do not release constraint; it's autoreleased? // TODO do not release constraint; it's autoreleased?
} }

View File

@ -24,11 +24,11 @@ BOOL firstvert = YES;
box = [[tBox alloc] tInitVertical:firstvert spaced:spaced]; box = [[tBox alloc] tInitVertical:firstvert spaced:spaced];
spinbox = [[tSpinbox alloc] init]; /* spinbox = [[tSpinbox alloc] init];
[box tAddControl:spinbox stretchy:NO]; [box tAddControl:spinbox stretchy:NO];
*/
[mainwin tSetControl:box]; [mainwin tSetControl:box];
/*
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced]; hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
button = [[tButton alloc] tInitWithText:@"Button"]; button = [[tButton alloc] tInitWithText:@"Button"];
[hbox tAddControl:button stretchy:YES]; [hbox tAddControl:button stretchy:YES];
@ -53,7 +53,7 @@ BOOL firstvert = YES;
button = [[tButton alloc] tInitWithText:@"CCC"]; button = [[tButton alloc] tInitWithText:@"CCC"];
[hbox tAddControl:button stretchy:NO]; [hbox tAddControl:button stretchy:NO];
[box tAddControl:hbox stretchy:NO]; [box tAddControl:hbox stretchy:NO];
*/
// TODO this isn't stretchy in the proper order // TODO this isn't stretchy in the proper order
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced]; hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
spinbox = [[tSpinbox alloc] init]; spinbox = [[tSpinbox alloc] init];
@ -61,14 +61,14 @@ BOOL firstvert = YES;
spinbox = [[tSpinbox alloc] init]; spinbox = [[tSpinbox alloc] init];
[hbox tAddControl:spinbox stretchy:YES]; [hbox tAddControl:spinbox stretchy:YES];
[box tAddControl:hbox stretchy:NO]; [box tAddControl:hbox stretchy:NO];
/*
hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced]; hbox = [[tBox alloc] tInitVertical:!firstvert spaced:spaced];
entry = [[tEntry alloc] init]; entry = [[tEntry alloc] init];
[hbox tAddControl:entry stretchy:NO]; [hbox tAddControl:entry stretchy:NO];
entry = [[tEntry alloc] init]; entry = [[tEntry alloc] init];
[hbox tAddControl:entry stretchy:YES]; [hbox tAddControl:entry stretchy:YES];
[box tAddControl:hbox stretchy:NO]; [box tAddControl:hbox stretchy:NO];
*/
[mainwin tShow]; [mainwin tShow];
} }

View File

@ -12,8 +12,8 @@
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
[s appendString:@" "]; [s appendString:@" "];
NSLog(@"%@%@ %d", s, [self className], (int) [self hasAmbiguousLayout]); NSLog(@"%@%@ %d", s, [self className], (int) [self hasAmbiguousLayout]);
if ([self hasAmbiguousLayout]) // if ([self hasAmbiguousLayout])
[[self window] visualizeConstraints:[[self superview] constraints]]; // [[self window] visualizeConstraints:[self constraints]];
for (j = 0; j < [[self subviews] count]; j++) for (j = 0; j < [[self subviews] count]; j++)
[[[self subviews] objectAtIndex:j] tIsAmbiguous:(indent + 1)]; [[[self subviews] objectAtIndex:j] tIsAmbiguous:(indent + 1)];
} }