2013-06-12 19:21:56 -07:00
|
|
|
//
|
|
|
|
// NBLoadingCell.m
|
|
|
|
// NewsBlur
|
|
|
|
//
|
|
|
|
// Created by Samuel Clay on 6/12/13.
|
|
|
|
// Copyright (c) 2013 NewsBlur. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "NBLoadingCell.h"
|
|
|
|
|
|
|
|
@implementation NBLoadingCell
|
|
|
|
|
|
|
|
@synthesize animating;
|
|
|
|
|
|
|
|
- (id)initWithFrame:(CGRect)frame
|
|
|
|
{
|
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
if (self) {
|
2015-12-07 16:09:49 -08:00
|
|
|
self.backgroundColor = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
|
2013-06-12 19:21:56 -07:00
|
|
|
animating = YES;
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)endAnimation {
|
|
|
|
animating = NO;
|
|
|
|
}
|
|
|
|
- (void)setNeedsLayout {
|
|
|
|
[super setNeedsLayout];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)layoutSubviews {
|
|
|
|
[super layoutSubviews];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)animate {
|
2013-06-12 19:49:10 -07:00
|
|
|
if (!self.window || !self.superview.window) return;
|
2013-06-12 19:21:56 -07:00
|
|
|
if (!animating) return;
|
2015-12-07 16:09:49 -08:00
|
|
|
self.backgroundColor = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
|
2016-10-05 21:03:32 -07:00
|
|
|
[UIView animateWithDuration:.650f delay:0.f options:0 animations:^{
|
2015-12-07 16:09:49 -08:00
|
|
|
self.backgroundColor = UIColorFromLightDarkRGB(0xE1EBFF, 0x222222);
|
2013-06-12 19:21:56 -07:00
|
|
|
} completion:^(BOOL finished) {
|
|
|
|
[UIView animateWithDuration:1.05f animations:^{
|
2015-12-07 16:09:49 -08:00
|
|
|
self.backgroundColor = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
|
2013-06-12 19:21:56 -07:00
|
|
|
} completion:^(BOOL finished) {
|
|
|
|
[self animate];
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|