私はこの機能を持っています、
-(void)transitionstar{
star.hidden = NO;
star2.hidden = NO;
star3.hidden = NO;
star4.hidden = NO;
star5.hidden = NO;
star6.hidden = NO;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4f];
[UIView animateWithDuration:0.0 animations:^{
CGAffineTransform scale = CGAffineTransformMakeScale(1, 1);
CGAffineTransform rotate = CGAffineTransformMakeRotation(360.0);
CGAffineTransform rotate2 = CGAffineTransformMakeRotation(-360.0);
CGAffineTransform rotate3 = CGAffineTransformMakeRotation(-720.0);
CGAffineTransform rotate4 = CGAffineTransformMakeRotation(720.0);
CGAffineTransform rotate5 = CGAffineTransformMakeRotation(1080.0);
CGAffineTransform rotate6 = CGAffineTransformMakeRotation(-1080.0);
CGAffineTransform translate = CGAffineTransformMakeTranslation(-800, -800);
CGAffineTransform translate2 = CGAffineTransformMakeTranslation(600, -600);
CGAffineTransform translate3 = CGAffineTransformMakeTranslation(400, 400);
CGAffineTransform translate4 = CGAffineTransformMakeTranslation(-200, 200);
CGAffineTransform translate5 = CGAffineTransformMakeTranslation(900, -300);
CGAffineTransform translate6 = CGAffineTransformMakeTranslation(-200, 500);
CGAffineTransform transform = CGAffineTransformConcat(translate, scale);
transform = CGAffineTransformConcat(transform, rotate);
CGAffineTransform transform2 = CGAffineTransformConcat(translate2, scale);
transform2 = CGAffineTransformConcat(transform2, rotate2);
CGAffineTransform transform3 = CGAffineTransformConcat(translate3, scale);
transform3 = CGAffineTransformConcat(transform3, rotate3);
CGAffineTransform transform4 = CGAffineTransformConcat(translate4, scale);
transform4 = CGAffineTransformConcat(transform4, rotate4);
CGAffineTransform transform5 = CGAffineTransformConcat(translate5, scale);
transform5 = CGAffineTransformConcat(transform5, rotate5);
CGAffineTransform transform6 = CGAffineTransformConcat(translate6, scale);
transform6 = CGAffineTransformConcat(transform6, rotate6);
star.transform = transform;
star2.transform = transform2;
star3.transform = transform3;
star4.transform = transform4;
star5.transform = transform5;
star6.transform = transform6;
}
completion:^(BOOL finished){
if (finished) {
star.hidden = YES;
star2.hidden = YES;
star3.hidden = YES;
star4.hidden = YES;
star5.hidden = YES;
star6.hidden = YES;
}
}];
[UIView commitAnimations];
}
初めて呼び出すと、うまくいきました。
ただし、同じビュー内で再度呼び出すと、実行できず、そこでスタックします。
・隠し仕事
-トランジションが機能しない
・回転が効かない
-nslog作業
なぜ2回目はこうなるのか?
アップデート
if(!positionrepeat)
{
//Display Correct IMAGE;
[isrepeat addObject:[NSNumber numberWithInt:positionvalue]];
//soundeffect = [self createSoundID: @"correct"];
//AudioServicesPlaySystemSound(soundeffect);
[self displayresulttext:@"correct"];
[self.view setNeedsDisplay];
[self transitionstar];
correct++;
completed.text = [NSString stringWithFormat:@"%d", correct];
[self result];
}
これが私が関数を呼び出す方法です。しかし、それはまだ同じです。