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; }