Skip to content

Commit

Permalink
Merge pull request instructure#12 from johnhaitas/master
Browse files Browse the repository at this point in the history
Storyboard refresh control loses tintColor fix
  • Loading branch information
bjhomer committed Jan 29, 2013
2 parents 7165713 + 57e686e commit db10327
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions CKRefreshControl/CKRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ @implementation CKRefreshControl {
UILabel *textLabel;
UIActivityIndicatorView *spinner;
CKRefreshArrowView *arrow;
UIColor *defaultTintColor;
CGFloat originalTopContentInset;
CGFloat decelerationStartOffset;
}
Expand All @@ -69,7 +70,10 @@ - (id) initWithCoder:(NSCoder *)aDecoder
[self commonInit];

if ([aDecoder containsValueForKey:@"UITintColor"])
{
self.tintColor = (UIColor *)[aDecoder decodeObjectForKey:@"UITintColor"];
defaultTintColor = self.tintColor;
}

if ([aDecoder containsValueForKey:@"UIAttributedTitle"])
self.attributedTitle = [aDecoder decodeObjectForKey:@"UIAttributedTitle"];
Expand All @@ -79,6 +83,7 @@ - (id) initWithCoder:(NSCoder *)aDecoder
selector: @selector(tableViewControllerDidSetView:)
name: CKRefreshControl_UITableViewController_DidSetView_Notification
object: nil ];

}
return self;
}
Expand All @@ -88,6 +93,7 @@ - (void) commonInit
self.frame = CGRectMake(0, 0, 320, 60);
[self populateSubviews];
[self setRefreshControlState:CKRefreshControlStateHidden];
defaultTintColor = [UIColor colorWithWhite:0.5 alpha:1];
}

- (void) tableViewControllerDidSetView: (NSNotification *) notification
Expand Down Expand Up @@ -139,7 +145,7 @@ - (void)populateSubviews {
- (void)setTintColor: (UIColor *) tintColor
{
if (!tintColor)
tintColor = [UIColor colorWithWhite:0.5 alpha:1];
tintColor = defaultTintColor;

textLabel.textColor = tintColor;
arrow.tintColor = tintColor;
Expand Down Expand Up @@ -386,8 +392,8 @@ + (id)appearance
return [super appearance];
}

+ (id)appearanceWhenContainedIn:(Class<UIAppearanceContainer>)ContainerClass, ... {
+ (id)appearanceWhenContainedIn:(Class<UIAppearanceContainer>)ContainerClass, ...
{
va_list list;
va_start(list, ContainerClass);

Expand Down

0 comments on commit db10327

Please sign in to comment.