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