0

I want my transform to scale the image whilst translating it, is it possible to do in the same method?

    [UIView beginAnimations:annKey context:NULL];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationCurve:curve];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
    CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
    CGAffineTransform scale = CGAffineTransformMakeScale(xx, yy);
    image.transform = scale;
    image.transform = transform;
    [UIView commitAnimations];
JH95
  • 489
  • 1
  • 7
  • 24

1 Answers1

0

You have to concatenate the two transforms using CGAffineTransformConcat to translate and scale your view. You're currently just replacing the scale transformation with the translation.

omz
  • 53,243
  • 5
  • 129
  • 141
  • [This answer](http://stackoverflow.com/a/3796238/573626) has an example. You can also look at the [documentation](http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGAffineTransform/Reference/reference.html#//apple_ref/c/func/CGAffineTransformConcat). – omz Jul 03 '12 at 19:41