ios 交換兩個uiview的簡單動畫
CGContextRef context=UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0f];
UIView *lastView=[self.view viewWithTag:103];
if(type==0)
{
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:lastView cache:YES];
}
else
{
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:lastView cache:YES];
}
UITableView *frontTableView=(UITableView *)[lastView viewWithTag:101];
UITableView *backTableView=(UITableView *)[lastView viewWithTag:102];
NSInteger frontIndex=[lastView.subviews indexOfObject:frontTableView];
NSInteger backIndex=[lastView.subviews indexOfObject:backTableView];
[lastView exchangeSubviewAtIndex:frontIndex withSubviewAtIndex:backIndex];
[UIView commitAnimations];
轉載:http://blog.csdn.net/liulichao20/article/details/10118029