Fixed build and runtime errors.

This commit is contained in:
Pietro Gagliardi 2015-08-02 23:05:16 -04:00
parent 2eb48aa129
commit 17a17b0d27
2 changed files with 17 additions and 16 deletions

View File

@ -59,8 +59,8 @@
- (void)tFillAutoLayout:(tAutoLayoutParams *)p
{
NSMutableDictionary *views;
__block uintmax_t n;
tAutoLayoutParams pp;
__block uintmax_t i, n;
__block tAutoLayoutParams pp;
__block BOOL anyStretchy;
NSMutableString *constraint;
@ -78,7 +78,7 @@
if ([isStretchy boolValue])
anyStretchy = YES;
[c tFillAutoLayout:&pp];
[views setObjject:pp.view forKey:tAutoLayoutKey(n)];
[views setObject:pp.view forKey:tAutoLayoutKey(n)];
n++;
}];
@ -89,23 +89,23 @@
constraint = [NSMutableString stringWithString:@"H:|"];
for (i = 0; i < n; i++) {
[constraint appendString:@"["];
[constraint appendString:tAutoLayoutKey(n)];
[constraint appendString:tAutoLayoutKey(i)];
[constraint appendString:@"]"];
}
[constraint appendString:@"|"];
[self->v addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
[constraint release];
[self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
// TODO do not release constraint; it's autoreleased?
// next make the views span the full other dimension
for (i = 0; i < n; i++) {
if (self->vertical)
constraint = [NSMutableString stringWithString:@"H:|"];
constraint = [NSMutableString stringWithString:@"H:|["];
else
constraint = [NSMutableString stringWithString:@"V:|"];
[constraint appendString:tAutoLayoutKey(n)];
constraint = [NSMutableString stringWithString:@"V:|["];
[constraint appendString:tAutoLayoutKey(i)];
[constraint appendString:@"]|"];
[self->v addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
[constraint release];
[self->v addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views]];
// TODO do not release constraint; it's autoreleased?
}
[views release];

View File

@ -74,9 +74,9 @@
[constraint appendString:margin];
[constraint appendString:@"|"];
}
constraints = [NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:p.views];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views];
[contentView addConstraints:constraints];
[constraint release];
// TODO do not release constraint; it's autoreleased?
constraint = [NSMutableString stringWithString:@"V:"];
if (p.attachTop) {
@ -88,11 +88,12 @@
[constraint appendString:margin];
[constraint appendString:@"|"];
}
constraints = [NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:p.views];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:constraint options:0 metrics:nil views:views];
[contentView addConstraints:constraints];
[constraint release];
// TODO do not release constraint; it's autoreleased?
[views release];
// TODO do not release views; it's autoreleased?
// (for all of these, look up whether the constructor autoreleases)
}
@end