- 实际显示效果比截图展示效果要好,偏移手机,阴影位置会跟着偏移
-直接拖到工程中使用
#import "YQMotionShadowView.h"
//对于任意一个需要加阴影的View,比如这里有个ImageView;
UIImageView *IMGV;
//生成一个阴影View
YQMotionShadowView *showView = [YQMotionShadowView fromView:IMGV];
//将阴影view显示,原View不需要再显示了
[self.view addSubview:showView];
//阴影颜色、透明度、模糊程度,就按Layer的方法去设置即可
showView.shadowColor = [UIColor darkGrayColor].CGColor;
showView.shadowOpacity = 0.8;
showView.shadowRadius = 20;
//视差View相关设置 -- 可以自己调节参数,对效果进行调整
//允许的阴影偏移量 - 默认30
showView.offset = 30;
//阴影移动速度 - 默认0.3
showView.speedLevel = 0.3;
//往中间恢复的速度 - 默认80
showView.backSpeed = 80;