Skip to content

Commit

Permalink
Fix bug where IB-set font styles would not be forwarded to the sublab…
Browse files Browse the repository at this point in the history
…el (Ref issue #64).
  • Loading branch information
cbpowell committed Aug 28, 2014
1 parent b401f0f commit 1ec4f7b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions MarqueeLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,22 @@ - (void)awakeFromNib {
- (void)forwardPropertiesToSubLabel {
// Since we're a UILabel, we actually do implement all of UILabel's properties.
// We don't care about these values, we just want to forward them on to our sublabel.
NSArray *properties = @[@"baselineAdjustment", @"enabled", @"font",
@"highlighted", @"highlightedTextColor", @"minimumFontSize",
@"shadowColor", @"shadowOffset", @"textAlignment", @"textColor",
NSArray *properties = @[@"baselineAdjustment", @"enabled", @"highlighted", @"highlightedTextColor",
@"minimumFontSize", @"shadowOffset", @"textAlignment",
@"userInteractionEnabled", @"text", @"adjustsFontSizeToFitWidth",
@"lineBreakMode", @"numberOfLines", @"backgroundColor"];
@"lineBreakMode", @"numberOfLines"];

// Iterate through properties
self.subLabel.font = super.font;
self.subLabel.textColor = super.textColor;
self.subLabel.backgroundColor = super.backgroundColor;
self.subLabel.shadowColor = super.shadowColor;
for (NSString *property in properties) {
id val = [super valueForKey:property];
[self.subLabel setValue:val forKey:property];
}

// Grab attributed text from super, and clear to prevent double-drawing
self.attributedText = super.attributedText;
// Clear super to prevent double-drawing
super.attributedText = nil;
}

Expand Down Expand Up @@ -509,7 +512,6 @@ - (BOOL)labelReadyForScroll {
if (!viewController.isViewLoaded) {
return NO;
}

// Check if application is in active state
// Prevents CATransaction completionBlock (which does not receive a "finished" parameter
// like UIView animations) from looping when the application has been backgrounded
Expand Down

0 comments on commit 1ec4f7b

Please sign in to comment.