iOS: add removeObserver in case addObserver being called multi times

This commit is contained in:
pengfei.zhou 2021-12-17 17:03:43 +08:00 committed by osborn
parent 2d1cf3fcfe
commit 5eb47355e0

View File

@ -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