首页 > 移动平台 > 详细

iOS开发中如何给UITableViewCell添加动画

时间:2015-03-27 14:33:25      阅读:239      评论:0      收藏:0      [点我收藏+]

UITableView可以说是iOS开发中最常用的控件了,作为一个高逼格的开发者,肯定不想局限于其平淡无奇的滚动效果,这时候我们就想着往上面倒腾出一些比较有意思的特效,下面来看看如何给UITableViewCell加特效!!

我们需要用到得代理方法:

willDisplayCell,顾名思义,在cell即将显示的时候会调用此方法.

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

添加动画

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

SDShotCell *shotCell = (SDShotCell *) cell;

CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];

scaleAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.8, 0.8, 1)];

scaleAnimation.toValue  = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1, 1, 1)];

scaleAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];

[shotCell.layer addAnimation:scaleAnimation forKey:@"transform"];

}

最终效果,有兴趣的还可以研究更多的动画效果.

技术分享

iOS开发中如何给UITableViewCell添加动画

原文:http://www.cnblogs.com/shaohuaios/p/4371444.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!