0
제 코드에서는 else 부분이 애니메이션되기 전에 부분을 원하지만 else 부분에는 포함되기를 원합니다. if else 절의 첫 번째 부분은 함수가 처음 호출 될 때 수행되며 그 부분 안에는 애니메이션의 절반에 해당하는 1 초 후에 함수를 호출하는 타이머 세트가 있지만이 마지막 부분은 필요하지 않습니다. 살아 움직이는듯한 느낌으로 나는 그것이 즉시 일어나길 바란다.UIView에서 특정 객체의 애니메이션을 애니메이션 지속 시간의 절반도 끝내야합니다.
-(void)performAnimationToRight
{
if (!timer){
[UIView beginAnimations:@"Move" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationBeginsFromCurrentState:YES];
card0.center = CGPointMake(card0.center.x+388, card0.center.y);
card1.center = CGPointMake(card1.center.x+388, card1.center.y);
card2.center = CGPointMake(card2.center.x+388, card2.center.y);
[UIView commitAnimations];
timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(performAnimationToRight) userInfo:nil repeats:NO];
}else{
card2.frame = CGRectMake(-330,card2.frame.origin.y, card2.frame.size.width, card2.frame.size.height);
timer = nil;
}
}
어떻게하면이 부분이 애니메이션으로 나타나지 않도록 할 수 있습니까?
card2.frame = CGRectMake(-330,card2.frame.origin.y, card2.frame.size.width, card2.frame.size.height);
감사합니다.