2012-07-03 4 views
0

Je veux que ma transformation permette d'agrandir l'image tout en la traduisant, est-il possible de faire dans la même méthode?CGAffineTransform ne fonctionne pas correctement

[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]; 

Répondre

0

Vous concaténer les deux transformations en utilisant CGAffineTransformConcat pour traduire et échelle de votre vue. Vous remplacez simplement la transformation d'échelle avec la traduction.

+0

[Cette réponse] (http://stackoverflow.com/a/3796238/573626) a un exemple. Vous pouvez également consulter la [documentation] (http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGAffineTransform/Reference/reference.html#//apple_ref/c/func/CGAffineTransformConcat). – omz