Yalantis / FoldingTabBar.iOS

Folding Tab Bar and Tab Bar Controller
https://yalantis.com
MIT License
3.68k stars 458 forks source link

Memory Issue #75

Closed zzz2016 closed 7 years ago

zzz2016 commented 7 years ago

Report a bug

What did you do?

Just click the main button, and then do it again and again and over again.

What did you expect to happen?

The memory should not increase.

What happened instead?

As the picture shown.

f4477926-ddff-4f4c-b99a-a40e6ed5b2c5

Your Environment

Project that demonstrates the bug

Official demo.

My suggestion

The code below:

+(instancetype)animationWithKeyPath:(NSString *)keyPath
                            duration:(CFTimeInterval)duration
                             damping:(double)damping
                            velocity:(double)velocity
                           fromValue:(double)fromValue
                             toValue:(double)toValue
{
    YALSpringAnimation *animation = [self.class animationWithKeyPath:keyPath];

    **
    animation.removedOnCompletion = NO;
    animation.fillMode = kCAFillModeForwards;
    **

    animation.duration = duration;
    animation.values = [self animationValuesFromValue:fromValue
                                              toValue:toValue
                                          withDamping:damping
                                          andVelocity:velocity];
    return animation;
}

The animation should be removed when finished.

Vodolazkyi commented 7 years ago

Problem solved in v1.1.2