美文网首页
iOS 点击tableViewCell翻转效果

iOS 点击tableViewCell翻转效果

作者: MMOTE | 来源:发表于2016-09-21 15:26 被阅读0次

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];

}

相关文章

网友评论

      本文标题:iOS 点击tableViewCell翻转效果

      本文链接:https://www.haomeiwen.com/subject/wbeaettx.html