简单tableView的cell的动画旋转

cell 的动画一般用的不多,但是简单的修改一下属性还是能把cell的出场华丽的转世一下,在代理方法willDisplayCell中设置一下layer的属性就OK了。

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

    //设置anchorPoint
    cell.layer.anchorPoint = CGPointMake(0, 0.5);
    //为了防止cell视图移动,重新把cell放回原来的位置
    cell.layer.position = CGPointMake(0, cell.layer.position.y);
    
    //设置cell 按照z轴旋转90度,注意是弧度
    cell.layer.transform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1.0);
    cell.alpha = 0.0;
    
    [UIView animateWithDuration:1 animations:^{
        cell.layer.transform = CATransform3DIdentity;
        cell.alpha = 1.0;
    } completion:^(BOOL finished) {
        
    }];
}

posted @ 2015-10-25 14:27  深水呛死鱼  阅读(182)  评论(0)    收藏  举报