0

私のアプリでは、加速度計の動きに合わせてボールを動かしていますが、ボールがスムーズに動きませんでした。ビュー上でボールをスムーズに動かす必要があります。

グーグルで検索して以下のステートメントを使用しましたが、滑らかなオブジェクトが得られませんでした

delta.x = 0.01 * delta.x + (1.0 - 0.01) * acceleration.x;
delta.y = 0.01 * delta.y + (1.0 - 0.01) * acceleration.y;
4

2 に答える 2

1

試す :

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
    point = CGPointMake(34*acceleration.x, -20*acceleration.y);
    image.center = CGPointMake(image.center.x+point.x,image.center.y);

}
于 2013-03-12T13:07:39.750 に答える
0

使用する

[UIView beginAniations:@"AnimaionName" context:nil];

[UIView setAnimationDuration: 2.0f];

imageView.frame = CGRectMake(,,,);

[UIView commitAnimation];

これでスムーズな動きになります

于 2013-03-12T13:31:16.167 に答える