mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
51 lines
1.1 KiB
Objective-C
51 lines
1.1 KiB
Objective-C
//
|
|
// 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) {
|
|
self.backgroundColor = UIColorFromRGB(0x5C89C9);
|
|
animating = YES;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)endAnimation {
|
|
animating = NO;
|
|
}
|
|
- (void)setNeedsLayout {
|
|
[super setNeedsLayout];
|
|
}
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
}
|
|
|
|
- (void)animate {
|
|
if (!self.window || !self.superview.window) return;
|
|
if (!animating) return;
|
|
self.backgroundColor = UIColorFromRGB(0x5C89C9);
|
|
[UIView animateWithDuration:.650f delay:0.f options:nil animations:^{
|
|
self.backgroundColor = UIColorFromRGB(0xE1EBFF);
|
|
} completion:^(BOOL finished) {
|
|
[UIView animateWithDuration:1.05f animations:^{
|
|
self.backgroundColor = UIColorFromRGB(0x5C89C9);
|
|
} completion:^(BOOL finished) {
|
|
[self animate];
|
|
}];
|
|
}];
|
|
}
|
|
|
|
@end
|