美文网首页
实现cell旋转加缩放

实现cell旋转加缩放

作者: super_lian | 来源:发表于2016-04-20 10:32 被阅读75次

、、、
-(void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {

/*  从锚点位置出发,逆时针绕 X 坐标轴旋转90度*/
CATransform3D transform3D = CATransform3DMakeRotation(M_PI_2, 1.0, 0.0, 0.0);
// 缩放 x 轴缩放 0.2
CATransform3D transform3D1 = CATransform3DScale(transform3D, 0.2, 1, 1);
//     定义 cell 的初始状态
cell.alpha = 0.0;
cell.layer.transform = transform3D1;
cell.layer.anchorPoint = CGPointMake(0.5, 0.5); // 设置锚点位置;默认为中心点(0.5, 0.5)

[UIView animateWithDuration:0.5 animations:^{
    cell.alpha = 1.0;
    cell.layer.transform = CATransform3DIdentity;
}];

}
、、、

相关文章

网友评论

      本文标题:实现cell旋转加缩放

      本文链接:https://www.haomeiwen.com/subject/dfmzlttx.html