Authored by Justin R. Miller

clean up constraints

@@ -517,20 +517,17 @@ @@ -517,20 +517,17 @@
517 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:container] && 517 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:container] &&
518 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:container]) 518 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:container])
519 { 519 {
520 - CGFloat topSpacing = container.frame.origin.y;  
521 - CGFloat rightSpacing = container.superview.bounds.size.width - container.frame.origin.x;  
522 -  
523 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topLayoutGuide]-topSpacing-[container]" 520 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topLayoutGuide]-topSpacing-[container]"
524 options:0 521 options:0
525 - metrics:@{ @"topSpacing" : @(topSpacing) } 522 + metrics:@{ @"topSpacing" : @(5) }
526 views:@{ @"topLayoutGuide" : viewController.topLayoutGuide, 523 views:@{ @"topLayoutGuide" : viewController.topLayoutGuide,
527 @"container" : container }]]; 524 @"container" : container }]];
528 525
529 526
530 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[container]-rightSpacing-|" 527 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[container]-rightSpacing-|"
531 options:0 528 options:0
532 - metrics:@{ @"rightSpacing" : @(rightSpacing) }  
533 - views:@{ @"container" : container }]]; 529 + metrics:@{ @"rightSpacing" : @(5) }
  530 + views:@{ @"container" : container }]];
534 } 531 }
535 } 532 }
536 533
@@ -539,9 +536,6 @@ @@ -539,9 +536,6 @@
539 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:_logoBug] && 536 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:_logoBug] &&
540 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:_logoBug]) 537 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:_logoBug])
541 { 538 {
542 - CGFloat leftSpacing = _logoBug.frame.origin.x;  
543 - CGFloat bottomSpacing = _logoBug.superview.bounds.size.height - _logoBug.frame.origin.y - _logoBug.bounds.size.height;  
544 -  
545 NSString *formatString; 539 NSString *formatString;
546 NSDictionary *views; 540 NSDictionary *views;
547 541
@@ -559,12 +553,12 @@ @@ -559,12 +553,12 @@
559 553
560 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:formatString 554 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:formatString
561 options:0 555 options:0
562 - metrics:@{ @"bottomSpacing" : @(bottomSpacing) } 556 + metrics:@{ @"bottomSpacing" : @(4) }
563 views:views]]; 557 views:views]];
564 558
565 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-leftSpacing-[logoBug]" 559 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-leftSpacing-[logoBug]"
566 options:0 560 options:0
567 - metrics:@{ @"leftSpacing" : @(leftSpacing) } 561 + metrics:@{ @"leftSpacing" : @(8) }
568 views:views]]; 562 views:views]];
569 } 563 }
570 } 564 }
@@ -574,9 +568,6 @@ @@ -574,9 +568,6 @@
574 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:_attributionButton] && 568 if ( ! [[viewController.view valueForKeyPath:@"constraints.firstItem"] containsObject:_attributionButton] &&
575 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:_attributionButton]) 569 ! [[viewController.view valueForKeyPath:@"constraints.secondItem"] containsObject:_attributionButton])
576 { 570 {
577 - CGFloat rightSpacing = _attributionButton.superview.bounds.size.width - _attributionButton.frame.origin.x - _attributionButton.bounds.size.width;  
578 - CGFloat bottomSpacing = _attributionButton.superview.bounds.size.height - _attributionButton.frame.origin.y - _attributionButton.bounds.size.height;  
579 -  
580 NSString *formatString; 571 NSString *formatString;
581 NSDictionary *views; 572 NSDictionary *views;
582 573
@@ -594,12 +585,12 @@ @@ -594,12 +585,12 @@
594 585
595 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:formatString 586 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:formatString
596 options:0 587 options:0
597 - metrics:@{ @"bottomSpacing" : @(bottomSpacing) } 588 + metrics:@{ @"bottomSpacing" : @(8) }
598 views:views]]; 589 views:views]];
599 590
600 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[attributionButton]-rightSpacing-|" 591 [viewController.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[attributionButton]-rightSpacing-|"
601 options:0 592 options:0
602 - metrics:@{ @"rightSpacing" : @(rightSpacing) } 593 + metrics:@{ @"rightSpacing" : @(8) }
603 views:views]]; 594 views:views]];
604 } 595 }
605 } 596 }
@@ -3782,8 +3773,8 @@ @@ -3782,8 +3773,8 @@
3782 _attributionButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin; 3773 _attributionButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
3783 _attributionButton.translatesAutoresizingMaskIntoConstraints = NO; 3774 _attributionButton.translatesAutoresizingMaskIntoConstraints = NO;
3784 [_attributionButton addTarget:self action:@selector(showAttribution:) forControlEvents:UIControlEventTouchUpInside]; 3775 [_attributionButton addTarget:self action:@selector(showAttribution:) forControlEvents:UIControlEventTouchUpInside];
3785 - _attributionButton.frame = CGRectMake(self.bounds.size.width - 30,  
3786 - self.bounds.size.height - 30, 3776 + _attributionButton.frame = CGRectMake(self.bounds.size.width - _attributionButton.bounds.size.width - 8,
  3777 + self.bounds.size.height - _attributionButton.bounds.size.height - 8,
3787 _attributionButton.bounds.size.width, 3778 _attributionButton.bounds.size.width,
3788 _attributionButton.bounds.size.height); 3779 _attributionButton.bounds.size.height);
3789 [self addSubview:_attributionButton]; 3780 [self addSubview:_attributionButton];