3

hy

我想做一个小动画。如果图像是静态的,旋转效果很好。但是当我移动我的图像视图时,它会拉伸图像。如果不旋转图像,则可以移动图像而不会出现问题。

-(void)play
{

        CGRect ship=image.frame;
        ship.origin.x=ship.origin.x+move;
        ship.origin.y=ship.origin.y+move2;
        image.frame=ship;
}

-(void)rotate 
{
       int degre=180;
       float radian=degre*(3.14/180);
       image.transform =CGAffineTransformMakeRotation(radian); 
}
4

1 回答 1

3

使用 transform 属性时,您不允许通过更改框架来更改位置,您必须使用 center 属性。

所以这应该有帮助:

-(void)play
{
    image.center=CGPointMake(image.center.x + move, image.center.y + move2);
}
于 2012-08-29T11:20:27.093 回答