嘿,所有的,在這裏有一個小問題,並不能弄清楚我做錯了什麼。我正在嘗試向上和向下反覆動畫UIView。當我開始播放時,它會正確地下降然後備份,但會立即開始播放到動畫的「最終」位置。代碼如下:iPhone - UIView動畫沒有正確循環
UIImageView *guide = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
guide.frame = CGRectMake(250, 80, 30, 30);
[self.view addSubview:guide];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:2];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationBeginsFromCurrentState:YES];
guide.frame = CGRectMake(250, 300, 30, 30);
[UIView setAnimationRepeatCount:10];
[UIView commitAnimations];
在此先感謝!