Skip to content

Commit

Permalink
Also set super values when changing non-text properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbpowell committed Jul 7, 2015
1 parent da38423 commit 21d64e5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MarqueeLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ - (void)setFont:(UIFont *)font {
return;
}
self.subLabel.font = font;
super.font = font;
[self updateSublabelAndLocations];
}

Expand All @@ -1112,6 +1113,7 @@ - (UIColor *)textColor {

- (void)setTextColor:(UIColor *)textColor {
[self updateSubLabelsForKey:@"textColor" withValue:textColor];
super.textColor = textColor;
}

- (UIColor *)backgroundColor {
Expand All @@ -1120,7 +1122,7 @@ - (UIColor *)backgroundColor {

- (void)setBackgroundColor:(UIColor *)backgroundColor {
[self updateSubLabelsForKey:@"backgroundColor" withValue:backgroundColor];
[super setBackgroundColor:backgroundColor];
super.backgroundColor = backgroundColor;
}

- (UIColor *)shadowColor {
Expand All @@ -1129,6 +1131,7 @@ - (UIColor *)shadowColor {

- (void)setShadowColor:(UIColor *)shadowColor {
[self updateSubLabelsForKey:@"shadowColor" withValue:shadowColor];
super.shadowColor = shadowColor;
}

- (CGSize)shadowOffset {
Expand All @@ -1137,6 +1140,7 @@ - (CGSize)shadowOffset {

- (void)setShadowOffset:(CGSize)shadowOffset {
[self updateSubLabelsForKey:@"shadowOffset" withValue:[NSValue valueWithCGSize:shadowOffset]];
super.shadowOffset = shadowOffset;
}

- (UIColor *)highlightedTextColor {
Expand All @@ -1145,6 +1149,7 @@ - (UIColor *)highlightedTextColor {

- (void)setHighlightedTextColor:(UIColor *)highlightedTextColor {
[self updateSubLabelsForKey:@"highlightedTextColor" withValue:highlightedTextColor];
super.highlightedTextColor = highlightedTextColor;
}

- (BOOL)isHighlighted {
Expand All @@ -1153,6 +1158,7 @@ - (BOOL)isHighlighted {

- (void)setHighlighted:(BOOL)highlighted {
[self updateSubLabelsForKey:@"highlighted" withValue:@(highlighted)];
super.highlighted = highlighted;
}

- (BOOL)isEnabled {
Expand All @@ -1161,6 +1167,7 @@ - (BOOL)isEnabled {

- (void)setEnabled:(BOOL)enabled {
[self updateSubLabelsForKey:@"enabled" withValue:@(enabled)];
super.enabled = enabled;
}

- (void)setNumberOfLines:(NSInteger)numberOfLines {
Expand All @@ -1183,6 +1190,7 @@ - (UIBaselineAdjustment)baselineAdjustment {

- (void)setBaselineAdjustment:(UIBaselineAdjustment)baselineAdjustment {
[self updateSubLabelsForKey:@"baselineAdjustment" withValue:@(baselineAdjustment)];
super.baselineAdjustment = baselineAdjustment;
}

- (CGSize)intrinsicContentSize {
Expand Down

0 comments on commit 21d64e5

Please sign in to comment.