Q
UIView旋轉
1
A
回答
8
嘗試類似的代碼
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.2]; CGAffineTransform rr=CGAffineTransformMakeRotation(5); yourView.transform=CGAffineTransformConcat(yourView.transform, rr); [UIView commitAnimations]; } -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [self touchesBegan:touches withEvent:event]; }
6
Pradeepa的代碼是好的,但是,動畫系統即將棄用(如果沒有的話)。嘗試這樣的事情,而不是:
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
double startRotationValue = [[[yourView.layer presentationLayer] valueForKeyPath:@"transform.rotation.z"] doubleValue];
rotation.fromValue = [NSNumber numberWithDouble:startRotationValue];
rotation.toValue = [NSNumber numberWithDouble:startRotationValue+5];
rotation.duration = 0.2;
[yourView.layer addAnimation:rotation forKey:@"rotating"];
我把Pradeepa的數字,使他們相媲美,但我認爲,蘋果更喜歡你使用這個或基於塊的動畫,而不是舊系統。
+0
感謝名單的人.....你真的救了我的時間.. ... thanx很多 – JKMania 2011-03-18 09:36:06
+0
謝謝,時間細細品味。 – user268743 2012-05-02 09:05:43
1
相關問題
- 1. 旋轉UIView iPhone
- 2. UIView:旋轉+移動
- 3. UIView旋轉否XIB
- 4. 如何旋轉UIView?
- 5. 旋轉UIView指向另一個UIView
- 6. 使用CGAffineTransform的UIView旋轉
- 7. 幻燈片和旋轉UIView
- 8. UIView的旋轉360°永遠
- 9. UIView與旋轉問題
- 10. UIView旋轉45°消失?
- 11. 使用UITouch旋轉UIView
- 12. 旋轉UIView不變形
- 13. 旋轉樞軸上的UIView
- 14. 基於UITouch旋轉UIView
- 15. 的UIView在iPhone旋轉
- 16. 旋轉UIView對象x軸
- 17. 使用CGAffineTransformMakeRotation旋轉UIView
- 18. UIView的旋轉中心
- 19. 用偏移旋轉UIView
- 20. UIView旋轉和移動
- 21. UIView觸控平滑旋轉
- 22. 在UIScrollview中旋轉UIView Swift
- 23. 旋轉UIView;如何在旋轉過程中防止裁剪?
- 24. 旋轉UIView並保持旋轉後的寬高比
- 25. 用一根手指旋轉UIView iPhone,iPad
- 26. 如何旋轉兩個UIView的?
- 27. 旋轉阿爾法一個UIView = 0
- 28. 自定義UIView旋轉問題
- 29. 旋轉放置和移動視圖(UIView)
- 30. 得到UIView的旋轉方向touchesMoved
感謝名單.......求救.... – JKMania 2011-03-18 09:35:19
並感謝投票太.... – JKMania 2011-03-18 09:56:20