通过下面的代码可以实现UITableCell的动画实现,只需要在有表格视图的地方加上下面的代码即可。前提是创建的cell显示数要大于屏幕显示数
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat rotationAngleDegrees = 0;
CGFloat rotationAngleRadians = rotationAngleDegrees * (M_PI/180);
CGPoint offsetPositioning = CGPointMake(-200, -20);
CATransform3D transform = CATransform3DIdentity;
transform = CATransform3DRotate(transform, rotationAngleRadians, 0.0, 0.0, 1.0);
transform = CATransform3DTranslate(transform, offsetPositioning.x, offsetPositioning.y, 0.0);
UIView *card = [cell contentView];
card.layer.transform = transform;
card.layer.opacity = 0.8;
[UIView animateWithDuration:1.0f animations:^{
card.layer.transform = CATransform3DIdentity;
card.layer.opacity = 1;
}];
}