Shankar BS
Shankar BS

Reputation: 8402

Warning during analysing CAKeyframeAnimation

I am getting the warning during the analysing my application i am attaching the screen shot, i am getting Dead store value stored for animationForButton2 during its initialisation
is never read enter image description here

where the button_2 is the custom UIButton how can shut this warning .. ?

Upvotes: 0

Views: 37

Answers (1)

Rob
Rob

Reputation: 437987

Just replace the lines that say:

CAKeyframeAnimation *animationForButton2 = [CAKeyframeAnimation animation];
animationForButton2 = [CAKeyframeAnimation animationWithKeyPath:@"position"];

With

CAKeyframeAnimation *animationForButton2 = [CAKeyframeAnimation animationWithKeyPath:@"position"];

In the original code sample, there's no point in instantiating animationForButton2 with a CAKeyframeAnimation, only to discard that and replace it with another CAKeyframeAnimation on the very next line.

Upvotes: 2

Related Questions