iOS-UITableViewCell的动画效果(一)

第一个动画

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
///配置 CATransform3D 动画内容
            CATransform3D  transform;
            transform.m34 = 1.0/-800;
            //定义 Cell的初始化状态
            cell.layer.transform = transform;
            //定义Cell 最终状态 并且提交动画
            [UIView beginAnimations:@"transform" context:NULL];
            [UIView setAnimationDuration:1];
            cell.layer.transform = CATransform3DIdentity;
            cell.frame = CGRectMake(0, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height);
            [UIView commitAnimations];
}
动画效果.gif

第二个动画

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
            CATransform3D  transform;
            transform = CATransform3DMakeRotation((CGFloat)((90.0 * M_PI) / 180.0), 0.0, 0.7, 0.4);
            transform.m34 = 1.0/-600;
            cell.layer.shadowColor = [[UIColor blackColor] CGColor];
            cell.layer.shadowOffset = CGSizeMake(10, 10);
            cell.alpha = 0;
            cell.layer.transform = transform;
            cell.layer.anchorPoint = CGPointMake(0, 0.5);//锚点
            if(cell.layer.position.x != 0){
                cell.layer.position = CGPointMake(0, cell.layer.position.y);
            }
            [UIView beginAnimations:@"transform" context:NULL];
            [UIView setAnimationDuration:0.8];
            cell.layer.transform = CATransform3DIdentity;
            cell.alpha = 1;
            cell.layer.shadowOffset = CGSizeMake(0, 0);
            [UIView commitAnimations];
}
动画效果2.gif
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥ios动画全貌。在这里你可以看...
    每天刷两次牙阅读 12,722评论 6 30
  • 在iOS实际开发中常用的动画无非是以下四种:UIView动画,核心动画,帧动画,自定义转场动画。 1.UIView...
    请叫我周小帅阅读 8,403评论 1 23
  • 概览 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你...
    Yiart阅读 9,294评论 3 34
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 10,541评论 5 13
  • 先看看CAAnimation动画的继承结构 CAAnimation{ CAPropertyAnimation { ...
    时间不会倒着走阅读 5,640评论 0 1

友情链接更多精彩内容