像這樣應用兩個轉換不會產生您期望的結果。你需要做的是將它們組合成一個單一的變換矩陣。以下應按預期工作。
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
// Create two separate transforms and concatenate them together.
// Use that new transform matrix to accomplish both transforms at once.
CGAffineTransform translate = CGAffineTransformMakeTranslation(0, 0);
CGAffineTransform scale = CGAffineTransformMakeScale(-1, 1);
resultsEnemy.transform = CGAffineTransformConcat(translate, scale);
[UIView commitAnimations];
編輯:基於關閉您澄清,你似乎想是這樣的:
CGAffineTransform scale = CGAffineTransformMakeScale(-1, 1);
CGAffineTransform translate = CGAffineTransformMakeTranslation(0, 0);
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
resultsEnemy.transform = scale;
[CATransaction commit];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
resultsEnemy.transform = CGAffineTransformConcat(translate, scale);
[UIView commitAnimations];
如果你把前變換*動畫塊? – 2013-02-28 21:57:55
當您應用兩個變形時,您只需創建一個(例如使用makeTranslation),然後您必須應用到當前CGAffineTransformRotate(resultsEnemy.transform,...),否則使用第二個變換完全覆蓋第一個變形 – Ultrakorne 2013-02-28 21:59:47