background color for constrained views optional

This commit is contained in:
Pfeil, Scott Robert 2019-06-26 13:09:31 -04:00
parent 01803e90d6
commit bd365d60d2
3 changed files with 8 additions and 2 deletions

View File

@ -115,7 +115,6 @@
[self setAsLight]; [self setAsLight];
} }
} }
} else { } else {
self.hidden = YES; self.hidden = YES;
} }
@ -169,4 +168,8 @@
return YES; return YES;
} }
- (BOOL)copyBackgroundColor {
return NO;
}
@end @end

View File

@ -326,7 +326,7 @@
if (self.molecule) { if (self.molecule) {
[self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; [self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
} }
if (self.constrainedView) { if (self.constrainedView && (![self.constrainedView respondsToSelector:@selector(copyBackgroundColor)] || [self.constrainedView performSelector:@selector(copyBackgroundColor)])) {
self.backgroundColor = self.constrainedView.backgroundColor; self.backgroundColor = self.constrainedView.backgroundColor;
} }
} }

View File

@ -21,6 +21,9 @@
/// Can be used to override any standard constraints that may be added. /// Can be used to override any standard constraints that may be added.
- (BOOL)useStandardConstraints; - (BOOL)useStandardConstraints;
/// Determines if the constraining view will copy the background color of the delegate.
- (BOOL)copyBackgroundColor;
/// Will align if it can. /// Will align if it can.
- (void)alignHorizontal:(UIStackViewAlignment)alignment; - (void)alignHorizontal:(UIStackViewAlignment)alignment;
- (void)alignVertical:(UIStackViewAlignment)alignment; - (void)alignVertical:(UIStackViewAlignment)alignment;