3

こんにちは、みんな、


私が使用したアニメーションの場合:

[UIView commitAnimation:@"anim" context:nil];
[UIView setAnumatioDuration:10];
imageView.center=CGPointMake(100,100);
[UIView commitAnimation];


問題は、タイマーで 0.5 秒ごとに呼び出すと、次のようになります。

CGRect rect=[[imageview.layer presentationLayer]frame];
CGPoint point=rect.origin;
NSLog(@"x:%f,y:%f",origin.x,origin.y);


私は常にx:100,y:100
を取得します そして、私が取得したいのは、イメージビューが (100,100) 10xに向かう
間、ビュー上の実際の位置です。

4

1 に答える 1

4

アニメーションは、ビューのプレゼンテーション レイヤーで更新されます。このレイヤーを見ることで、アニメーション中に画像ビューの現在の状態を表す値を取得できます。

CGPoint center = [[imageView.layer presentationLayer] center];
于 2011-10-24T09:26:05.653 に答える