博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS开发中如何给UITableViewCell添加动画
阅读量:7075 次
发布时间:2019-06-28

本文共 988 字,大约阅读时间需要 3 分钟。

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

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

转载于:https://www.cnblogs.com/shaohuaios/p/4371444.html

你可能感兴趣的文章
JQuery在循环中绑定事件的问题详解
查看>>
SOCKS 5协议详解(转)
查看>>
用Inno Setup来解决.NetFramework安装问题 (转载)
查看>>
使用axis调用WebService服务端
查看>>
Tomcat抛出异常:ClientAbortException: java.net.SocketException: Connection
查看>>
关闭百度广告联盟广告推送
查看>>
Atitit 项目中的勋章体系,,mvp建设 ,荣典体系建设
查看>>
树莓派重装系统
查看>>
IIS-反向代理
查看>>
C# 之 串口数据侦听的实现
查看>>
白盒测试的测试用例设计有哪些方法
查看>>
sql group by+字段
查看>>
python+uwsgi导致redis无法长链接引起性能下降问题记录
查看>>
Android:关于声明文件中android:process属性说明
查看>>
ArcSDE中Compress与Compact的区别
查看>>
[Most.js] Create Streams From Single Values With Most.js
查看>>
jQuery文档加载完毕的几种写法
查看>>
windows server远程连接提示“终端服务器超出了最大允许连接”
查看>>
Spring MVC表单处理
查看>>
Oracle数据库迁移
查看>>