From 8393870653b3e6b386bba30713e5bccd82073dad Mon Sep 17 00:00:00 2001 From: Nicklas Ansman Giertz Date: Wed, 22 Nov 2017 14:41:24 -0500 Subject: [PATCH] Implement initWithCoder: in LOTAnimatedControl Without it you cannot use LOTAnimatedControl in interface builder. --- .../Classes/Private/LOTAnimatedControl.m | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lottie-ios/Classes/Private/LOTAnimatedControl.m b/lottie-ios/Classes/Private/LOTAnimatedControl.m index 83e9ff4bd3..7d5efbf45b 100644 --- a/lottie-ios/Classes/Private/LOTAnimatedControl.m +++ b/lottie-ios/Classes/Private/LOTAnimatedControl.m @@ -17,15 +17,27 @@ - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { - _animationView = [[LOTAnimationView alloc] init]; - _animationView.contentMode = UIViewContentModeScaleAspectFit; - _animationView.userInteractionEnabled = NO; - [self addSubview:_animationView]; - _layerMap = [NSMutableDictionary dictionary]; + [self _commonInit]; } return self; } +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + [self _commonInit]; + } + return self; +} + +- (void)_commonInit { + _animationView = [[LOTAnimationView alloc] init]; + _animationView.contentMode = UIViewContentModeScaleAspectFit; + _animationView.userInteractionEnabled = NO; + [self addSubview:_animationView]; + _layerMap = [NSMutableDictionary dictionary]; +} + - (LOTComposition *)animationComp { return _animationView.sceneModel; }