12.制作一个简单的动画:
- (IBAction)curlAction:(id)sender
{
//开始一个动画
[UIView beginAnimations:nil context:NULL];
//设置动画得时间间隔
[UIView setAnimationDuration:kTransitionDuration];
//设置动画得旋转方式
[UIView setAnimationTransition:([self.mainView superview] ?
UIViewAnimationTransitionCurlUp : UIViewAnimationTransitionCurlDown)
forView:self.containerView cache:YES];
if ([self.flipToView superview])
{
[self.flipToView removeFromSuperview];
[self.containerView addSubview:self.mainView];
}
else
{
[self.mainView removeFromSuperview];
[self.containerView addSubview:self.flipToView];
}
[UIView commitAnimations];
}