阴影

作者: 文扉Song | 来源:发表于2017-08-28 11:31 被阅读4次
    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;

    相关文章

      网友评论

          本文标题:阴影

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