NewsBlur/clients/ios/Classes/NBLoadingCell.m
David Sinclair 27fbf12081 iOS: fixed #929 (rotation issue on iPhone with Safari browser)
This was a curly one!  I also fixed a bunch of Xcode 8 warnings (for
non-third-party code; I'd like to fix the third-party ones to get to
zero warnings, but don't know how you feel about that).
2016-10-05 21:03:32 -07:00

51 lines
1.2 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 = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
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 = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
[UIView animateWithDuration:.650f delay:0.f options:0 animations:^{
self.backgroundColor = UIColorFromLightDarkRGB(0xE1EBFF, 0x222222);
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.05f animations:^{
self.backgroundColor = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
} completion:^(BOOL finished) {
[self animate];
}];
}];
}
@end