0
我想爲我的應用添加動畫。我有一張卡,我想將它移動到中心位置,然後卡從右側翻轉。我用這個代碼;從右拖倒
[self.scrollView bringSubviewToFront:self.image1];
CATransition *animation = [CATransition animation];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionFade;
animation.duration = 0.75;
[self.image1.layer addAnimation:animation forKey:@"kCATransitionFade"];
[UIView animateWithDuration:0.5 animations:^{
self.image1.frame = CGRectMake(90,self.scrollView.frame.origin.y+40, 140, 250);
}];
self.image1.transform = CGAffineTransformMakeScale(0.1,0.1);
[self.view bringSubviewToFront:self.image1];
[UIView beginAnimations:@"fadeInNewView" context:NULL];
[UIView setAnimationDuration:1.0];
self.image1.transform = CGAffineTransformMakeScale(2,2);
self.image1.alpha = 1.0f;
[UIView commitAnimations];
UIImage *imageTest=[UIImage imageNamed:@"home.png"];
[UIView transitionWithView:self.image1 duration:1
options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
self.image1.image = imageTest;
} completion:nil];
但卡之前翻轉到新的框架。任何ideea我該如何解決這個問題>
只需通過編寫animateWithDuration嘗試:塊內transitionWithView:塊 –