1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/legacy/TelegraphKit/TGAnimationBlockDelegate.m
2015-10-01 19:19:52 +03:00

38 lines
692 B
Objective-C

#import "TGAnimationBlockDelegate.h"
@implementation TGAnimationBlockDelegate
- (instancetype)initWithLayer:(CALayer *)layer
{
self = [super init];
if (self != nil)
{
_layer = layer;
}
return self;
}
- (void)animationDidStart:(CAAnimation *)__unused anim
{
}
- (void)animationDidStop:(CAAnimation *)__unused anim finished:(BOOL)flag
{
CALayer *layer = _layer;
if (flag)
{
if (_opacityOnCompletion != nil)
layer.opacity = [_opacityOnCompletion floatValue];
}
if (_removeLayerOnCompletion)
[layer removeFromSuperlayer];
if (_completion)
_completion(flag);
_completion = nil;
}
@end