次のコードブロックを使用してUIViewをスライドさせ、別のUIViewを終了すると終了します。 アニメーションの2番目の部分では、完了ブロックは1回だけ実行されます。これは、最初のアニメーションが完了しなかったことを意味し、完了ブロックに到達しないことを意味します。 iphoneシミュレータでは、最初のアニメーションが終了したように見えます... 誰も私がこれを理解するのを手助けできますか? は私のNSLogは言う:私のanimatewithduration、完了ブロックは1回だけ実行されます
が第一
を終えた第二
を開始した第一
が第一
を終え終えた第一
を終えました。
。
。
- (IBAction) move
{
[UIView animateWithDuration:0.7 animations:^{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.7];
[UIView setAnimationRepeatCount:1];
[UIView setAnimationRepeatAutoreverses:NO];
CGPoint pos = movingtTable.center;
float moveDistance = 220.0;
if(!isViewVisible){
//expose the view
pos.y = pos.y+moveDistance;
//disable selection for xy table
xTable.userInteractionEnabled = NO;
yTable.userInteractionEnabled = NO;
//angle = M_PI;
}
else
{
pos.y = pos.y-moveDistance;
xTable.userInteractionEnabled = YES;
yTable.userInteractionEnabled = YES;
//angle = -M_PI;
}
isViewVisible = !isViewVisible;
movingtTable.center = pos;
NSLog(@"finished 1st");
}completion:^(BOOL finished){
NSLog(@"started 2nd");
[UIView animateWithDuration:0.4 animations:^{
//[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
//[UIView setAnimationRepeatCount:1];
//[UIView setAnimationRepeatAutoreverses:NO];
arrows.transform = CGAffineTransformMakeRotation(angle);
}completion:^(BOOL finished){
angle = -angle;
}];
}];
ダン、参考になりまし回答のいずれかでしたか?あなたは彼らが働くのを見つけましたか?もしそうなら、あなたが最良のものを「受け入れる」か、あなたの発見にコメントをすることは誰にとっても役に立ちます。乾杯 – MobileVet