当前位置: 代码迷 >> Iphone >> iphone中图盘绕一个点旋转的动画效果
  详细解决方案

iphone中图盘绕一个点旋转的动画效果

热度:75   发布时间:2016-04-25 06:30:18.0
iphone中图围绕一个点旋转的动画效果

?

iphone中如何使图片围绕一个点旋转?

?

    UIView *vw = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 200, 200)];    vw.backgroundColor = [UIColor brownColor];    [self.view addSubview:vw];            [UIView beginAnimations:nil context:nil];     [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];     [UIView setAnimationDuration:1.5f];    vw.layer.anchorPoint = CGPointMake(0.5,0.5);    vw.transform = CGAffineTransformMakeRotation([self radians:-180]);    [UIView commitAnimations];

?

#define M_PI 3.14159265358979323846264338327950288

-(double)radians:(double)degrees{    return degrees * M_PI/180;}

?

这个属性表示你这个图片setPosition时的点在图片上所处的位置.
取值范围0-1
0,0表示左下角,
1,1表示右上角
0.5,0.5表示图片的中心点.

所有的图片都是以矩形来界定的.

  相关解决方案