7
A
回答
25
所以我按下后进入我突然把两个和两个在一起,并认为节拍器样品工作有点像一个摇摆门,这导致了我一些其他的可能性。
这里是我的解决方案:
- (void)viewDidLoad {
[super viewDidLoad];
// Set the anchor point and center so the view swings from the upper right
swingView.layer.anchorPoint = CGPointMake(1.0, 0.0);
swingView.center = CGPointMake(CGRectGetWidth(self.view.bounds), 0.0);
// Rotate 90 degrees to hide it off screen
CGAffineTransform rotationTransform = CGAffineTransformIdentity;
rotationTransform = CGAffineTransformRotate(rotationTransform, DegreesToRadians(90));
swingView.transform = rotationTransform;
}
...
- (void)animateSwing {
CGAffineTransform swingTransform = CGAffineTransformIdentity;
swingTransform = CGAffineTransformRotate(swingTransform, DegreesToRadians(0));
[UIView beginAnimations:@"swing" context:swingView];
[UIView setAnimationDuration:0.25];
swingView.transform = swingTransform;
[UIView commitAnimations];
}
希望这有助于别人呢!
0
-4
你应该试试这个代码:
-(void)doRotationView{
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft
forView:self cache:YES];
if (flagFront == 1) {
flagFront =0;
[self.viewSecond setHidden:NO];
[self.viewFirst setHidden:YES];
}
else{
flagFront =1;
[self.viewSecond setHidden:YES];
[self.viewFirst setHidden:NO];
}
[UIView commitAnimations];
}
相关问题
- 1. 如何在Y轴上向左或向右旋转90度?
- 2. 如何从视图的右角将视图从-90旋转到0与动画
- 3. 如何旋转TeeChart 90度
- 4. android按钮右对齐旋转-90度
- 5. 如何将输出旋转90度?
- 6. 旋转CALayer 90度?
- 7. 如何在iOS上将图像旋转90度?
- 8. 没有相机的SurfaceView:开始旋转90度后预览
- 9. 了解如何旋转矩阵90度
- 10. 如何顺时针旋转90度(swift3)
- 11. 如何旋转90度的UIImage?
- 12. 使用GDI将文本旋转90度
- 13. DIV旋转90度和位置固定在左上角
- 14. 圆球90度旋转
- 15. 旋转NSImageView的CALayer 90度
- 16. 旋转GoJs形状90度
- 17. 矩形旋转90度libgdx
- 18. 旋转(90度)的ViewGroup根
- 19. 子报表旋转90度
- 20. openGL向前移动,旋转角度为0度,向后角度为90度
- 21. 将图片旋转90°
- 22. 如何在水平面上旋转x轴标签90度
- 23. 如何将90度旋转标签与像素完美对齐?
- 24. 如何将FullCalendar事件文本旋转90度为垂直
- 25. X11:如何将重力/方向旋转到90度
- 26. 旋转90度后,如何将图像添加到CALayer背面?
- 27. 如何将N×N矩阵旋转90度?
- 28. 如何获取的角度,而我想旋转的UIView
- 29. 将UIView设置为从左上角开始(0,0)
- 30. 旋转角度
顺便说一下,这个答案是什么导致我从节拍器样本不同的动画。我认为它更清洁一点。 http://stackoverflow.com/questions/929364/how-to-create-iphones-wobbling-icon-effect/930101#930101 – dandax 2010-11-02 13:10:36
我会用90°== M_PI_2 – Ralphleon 2013-02-26 16:41:02
#define DEGREES_RADIANS(angle)((angle)/ 180.0 * M_PI) – 2014-09-04 11:47:56