pstrag
pstrag

Reputation: 617

How to not animate transformation?

How can I not animate transformation during moving some frame? I have some block with animation:

        [UIView animateWithDuration:.2 animations:^{
            self.center = [ViewController fitPointToNet:self.center];
            [self.delegate repaint];
        }];

And repaint call paintInView method. This method draw some figure (e.g. line) and rotate them. I want to animation look like line move to destination point - now it move and rotate.

- (void)paintInView:(UIView*)view 
{
//some drawing code   
line.transform = CGAffineTransformMakeRotation(M_PI);
//some drawing code
}

Anyone can help?

Upvotes: 1

Views: 95

Answers (1)

jrturton
jrturton

Reputation: 119242

You're calling the repaint method from within the animation block - so any changes to animatable properties of any view will be animated.

You should call that method from the completion block of the animation instead - use the animateWithDuration:animations:completion method instead of the one you are using now.

This will perform the transform without animating, after the animation has completed.

Upvotes: 1

Related Questions