UIImageView绕着一个点旋转

pointer= [[UIImageViewalloc]initWithImage:

[UIImageimageNamed:@"poi.png"]];

pointer.frame=CGRectMake(73,72,6,51);

pointer.layer.anchorPoint=CGPointMake(0.55,0.936);

//设置旋转中心,0.55表示横向55%处,0.936表示纵向93.6%处,均是以poi.png

//的长宽为基准

[self.viewaddSubview:pointer];

//上面将pointer加到view上,若使pointer绕旋转中心转动如下:

floatangle=1.0;//要旋转的弧度

CGAffineTransformtransform =

CGAffineTransformMakeRotation(angle);

pointer.transform= transform;

//这是顺时针旋转,若要逆时针需令angle = -1.0;

原创http://blog.csdn.net/u010132419/article/details/8920207

你可能感兴趣的:(UIImageView绕着一个点旋转)