阴影

self.layer.masksToBounds = NO;
self.layer.shadowColor = color.CGColor; // 阴影的颜色
self.layer.shadowOpacity = opacity; // 阴影透明度
self.layer.shadowOffset = CGSizeMake(0,0); // 阴影的范围
self.layer.shadowRadius = spread/2; // 阴影扩散的范围控制

float border=spread/2;
self.layer.shadowOpacity = opacity;
self.layer.masksToBounds = NO;
self.layer.shadowColor = color.CGColor;
self.layer.shadowRadius = border;
self.layer.shadowOffset = CGSizeMake(0,0);

float width = self.bounds.size.width;
float height = self.bounds.size.height;

UIBezierPath* aPath = [UIBezierPath bezierPathWithRect:CGRectMake(-border, -
border, width+border, height+border)];
aPath.lineWidth = border;
aPath.lineCapStyle = kCGLineCapRound;
aPath.lineJoinStyle = kCGLineCapRound;
self.layer.shadowPath = aPath.CGPath;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容