//
//  UIView+GMShadow.m
//  Gengmei
//
//  Created by lizhen on 2019/3/20.
//  Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//

#import "UIView+GMShadow.h"

@implementation UIView (GMShadow)

#pragma mark - 设置四边阴影效果
- (void)addShadow:(UIColor *)shadowColor
    shadowOpacity:(CGFloat)shadowOpacity
     shadowRadius:(CGFloat)shadowRadius
     shadowOffset:(CGSize)shadowOffset {
    self.layer.shadowColor = shadowColor.CGColor;
    self.layer.shadowOffset = shadowOffset;
    self.layer.shadowOpacity = shadowOpacity;
    self.layer.shadowRadius = shadowRadius;
}

#pragma mark - 设置单边阴影效果
- (void)addShadow:(UIColor *)shadowColor shadowOpacity:(CGFloat)shadowOpacity shadowRadius:(CGFloat)shadowRadius shadowOffset:(CGSize)shadowOffset shadowFrame:(CGRect)shadowFrame {
    self.layer.shadowColor = shadowColor.CGColor;
    self.layer.shadowOffset = shadowOffset;
    self.layer.shadowOpacity = shadowOpacity;
    self.layer.shadowRadius = shadowRadius;
    self.layer.masksToBounds = NO;
    UIBezierPath *path = [UIBezierPath bezierPathWithRect:shadowFrame];
    self.layer.shadowPath = path.CGPath;
}

@end
