最近、アプリで問題が発生しました。
私は通常使用します
[UIView animateWithDuration:(NSTimeInterval) animations:^{...} completion:^(BOOL finished) {...}];
私のアニメーションを作るために、今まで完璧に機能しました。これが私の問題のコードです
UIImageView *someimage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"someimage"]];
[someimage setFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubView:someimage];
[UIView animateWithDuration:0.5 animations:^{
[someimage setFrame:CGRectMake(400, 400, 200, 200)];
} completion:^(BOOL finished) {
NSLog(@"Just finish moving some image lets rotate it!");
[UIView animateWithDuration:0.5 animations:^{
someimage.transform = CGAffineTransformMakeRotation(M_PI);
} completion:^(BOOL finished) {
NSLog(@"What just happened?");
}];
}];
画像を取得し、アニメーションを使用してあるコーナーから別の位置に移動しました。次に、アニメーションが終了したら回転させますが、その回転を行うと、UIImageView が再びコーナーに表示されます。
なぜこれが起こるのか、そしてそれをどのように処理するのか、誰かが私に説明できますか?
ありがとう!