(抄)UITableVIewCell在显示时逐个滑入动效

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

//1. Setup the CATransform3D structure

CATransform3D rotation;

rotation = CATransform3DIdentity;

rotation =  CATransform3DTranslate(rotation, 30, 0, 0); //CATransform3DMakeRotation( (15*M_PI)/180, 0.0, 0.7, 0.5);

rotation.m34 = 1.0/ -500;

//2. Define the initial state (Before the animation)

cell.layer.shadowColor = [[UIColor blackColor]CGColor];

cell.layer.shadowOffset = CGSizeMake(10, 10);

cell.alpha = 0.0;

cell.layer.transform = rotation;

cell.layer.anchorPoint = CGPointMake(0, 0.5);

//!!!FIX for issue #1 Cell position wrong------------

if(cell.layer.position.x != 0){

cell.layer.position = CGPointMake(0, cell.layer.position.y);

}

//3. Define the final state (After the animation) and commit the animation

double secondsDelay = indexPath.row *0.08;

if (secondsDelay > 0.6) {

secondsDelay = 0.1;

}

[UIView animateWithDuration:0.5 delay:secondsDelay usingSpringWithDamping:1.0 initialSpringVelocity:0.5 options:0 animations:^{

cell.layer.transform = CATransform3DIdentity;

cell.alpha = 1;

cell.layer.shadowOffset = CGSizeMake(0, 0);

} completion:^(BOOL finished) {}];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥ios动画全貌。在这里你可以看...
    每天刷两次牙阅读 8,580评论 6 30
  • 1.nav1.navigationBar.barStyle=UIBarStyleBlack; //改变导航栏背景颜...
    SadMine阅读 1,655评论 1 4
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 5,147评论 5 13
  • 转载:http://www.jianshu.com/p/32fcadd12108 每个UIView有一个伙伴称为l...
    F麦子阅读 6,321评论 0 13
  • 好天气真的会给人带来好心情的 即使朝九晚五的按部就班 我也不愿放弃自己喜欢做的事情 摄影来自 今天心情好转的我 说...
    SoulFrancis阅读 226评论 1 1