1、动画效果
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView commitAnimations];
2、点击tableviewCell翻转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
switch (indexPath.row) {
case 0:
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:[tableView cellForRowAtIndexPath:indexPath] cache:YES];
break;
case 1:
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[tableView cellForRowAtIndexPath:indexPath] cache:YES];
break;
case 2:
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[tableView cellForRowAtIndexPath:indexPath] cache:YES];
break;
case 3:
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:[tableView cellForRowAtIndexPath:indexPath] cache:YES];
break;
default:
break;
}
[UIView commitAnimations];
}
3、点击按钮 前三个Cell翻转
for (int i = 0; i < 3; i ++) {
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:[myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]] cache:NO];
[UIView commitAnimations];
}
4、点击按钮 全部Cell翻转
int rows = [myTableView numberOfRowsInSection:0];
for (int i = rows - 1; i > rows - 1 - 4; i--) {
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]] cache:NO];
[UIView commitAnimations];
}
网友评论