2012-07-03 59 views
0

我希望我的變換將圖像縮放,同時它翻譯,是否有可能在同一個方法呢?CGAffineTransform工作不正常

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

回答

0

你必須使用串聯到CGAffineTransformConcat翻譯規模視圖兩個變換。您目前只是用翻譯替換比例轉換。

+0

[本答案](http://stackoverflow.com/a/3796238/573626)具有一個例子。您還可以看看[文件](http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGAffineTransform/Reference/reference.html#//apple_ref/c/func/CGAffineTransformConcat)。 – omz