//cell将要出现调用的方法
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// 图层一旦创建,你就可以通过矩阵变换来改变一个图层的几何形状。CATransform3D的数据结构定义一个同质的三维变换(4×4 CGFloat值的矩阵),用于图层的旋转,缩放,偏移,歪斜和应用的透视。
CATransform3D translation; //变换矩阵
translation = CATransform3DMakeTranslation(150, 0, 0); //变换函数
// tx:X轴偏移位置,往下为正数。
// ty:Y轴偏移位置,往右为正数。
// tz:Z轴偏移位置,往外为正数。
cell.layer.shadowColor = [[UIColor blackColor]CGColor];
cell.layer.shadowOffset = CGSizeMake(10, 10);
cell.alpha = 0;
cell.layer.transform = translation;
[UIView beginAnimations:@"translation" context:NULL]; //标记动画块开始
[UIView setAnimationDuration:0.7];
cell.layer.transform = CATransform3DIdentity;//CATransform3DIdentity是单位矩阵,该矩阵没有缩放、旋转、歪斜、透视。把该矩阵应用到图层上面,会把图层几何属性修改为默认值。
cell.alpha = 1;
cell.layer.shadowOffset = CGSizeMake(0, 0);
[UIView commitAnimations]; //标记动画块结束
}