self.firstView = [[UIView alloc] initWithFrame:CGRectMake(100, 164, 200, 200)];
//“shadowOpacity是一个必须在0.0(不可见)和1.0(完全不透明)之间的浮点数。如果设置为1.0,将会显示一个有轻微模糊的黑色阴影稍微在图层之上。”
self.firstView.layer.shadowOpacity = 0.5f;
//设置阴影,默认值是引用向下
self.firstView.layer.shadowOffset= CGSizeMake(10.f, 20.f);
//设置阴影颜色
self.firstView.layer.shadowColor = [UIColor blackColor].CGColor;
//设置阴影模糊度
self.firstView.layer.shadowRadius = 5.f;
self.firstView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.firstView];
//仿射变换
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_4);
self.firstView.layer.affineTransform = transform;
//混合变换
transform = CGAffineTransformIdentity; //scale by 50%
transform = CGAffineTransformScale(transform, 0.5, 0.5);
transform= CGAffineTransformRotate(transform, M_PI/180.0*30.0);
transform = CGAffineTransformTranslate(transform, 200, 0);
self.firstView.layer.affineTransform = transform;
//3D变换
CATransform3D transform3 = CATransform3DIdentity;
//应用透视效果
transform3.m34 = -1.0/500;
transform3 = CATransform3DRotate(transform3, M_PI_4, 0, 1, 0);
self.firstView.layer.transform = transform3;