From 5eb47355e0e77fc373197ef1a491937cb35e4a04 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 17 Dec 2021 17:03:43 +0800 Subject: [PATCH] iOS: add removeObserver in case addObserver being called multi times --- doric-iOS/Pod/Classes/Shader/DoricImageNode.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m index 5a3521b3..5aaa3e68 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m @@ -557,6 +557,13 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id } else if ([@"imageScale" isEqualToString:name]) { //Do not need set } else if ([@"onAnimationEnd" isEqualToString:name]) { + if (self.animationEndCallbackId) { +#if DORIC_USE_YYWEBIMAGE + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentIsPlayingAnimation" context:nil]; +#elif DORIC_USE_SDWEBIMAGE + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentFrameIndex" context:nil]; +#endif + } self.animationEndCallbackId = prop; DoricImageView *doricImageView = (DoricImageView *) view; #if DORIC_USE_YYWEBIMAGE