Skip to content

NSTimer #1

@kohtenko

Description

@kohtenko

Hi, NSTimer in your control is never stops and because of that object never released. Actually, I think you don't even need NSTimer. Try this for smooth rotation:

define RADIANS(degrees) ((degrees * M_PI) / 180.0)

  • (void)startAnimating {
    [self.activityImageView.layer removeAnimationForKey:@"ROTATE_ANIMATION"];
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    animation.duration = 0.1;
    animation.cumulative = YES;
    animation.repeatCount = NSIntegerMax;
    animation.toValue = @(M_2_PI);
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    animation.removedOnCompletion = NO;

    [self.activityImageView.layer addAnimation:animation forKey:@"ROTATE_ANIMATION"];

    self.hidden = NO;
    }

  • (void)stopAnimating {
    [self.activityImageView.layer removeAnimationForKey:@"ROTATE_ANIMATION"];
    }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions