안녕하세요 저는 몇 가지 기본 UIView 애니메이션을 가지고 놀고 있습니다. 반복 횟수를 100으로 설정하여 반복적으로 위아래로 움직이는 것을 볼 수 있습니다. 내보기를 180도 회전하도록 전환 설정iPhone UIView 반복되는 애니메이션 문제
이동 중에 내보기가 회전하는 것을 볼 수 있습니다. 그러나 몇 번 반복하면 .. 보기가 계속 위아래로 움직이지만 더 이상 회전하지 않습니다. 같은 루프에서 회전이 멈추는 이유는 모르겠습니까? 당신은 변환 설정 후 을 animationRepeatAutoreverses을 설정하기 때문에 발생하는 이유는
- (void)viewDidLoad {
[super viewDidLoad];
CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI);
Shape* shapeView = [[Shape alloc] initWithShapeName:@"test" frame:CGRectMake(100, 0, 50, 50)];
[self.view addSubview:shapeView];
[UIView beginAnimations:@"test animation" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationRepeatCount:100];
shapeView.transform = trans;
[UIView setAnimationRepeatAutoreverses:YES];
shapeView.frame = CGRectMake(100,300,50,50);
[UIView commitAnimations];
[shapeView release];
}
감사
고맙습니다. 지금 어디에서 잘못했는지 봅니다! – y62wang