//
//  UIView+CornerRadius.m
//  Gengmei
//
//  Created by wangyang on 2017/12/7.
//  Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//

#import "UIView+CornerRadius.h"
#import <Masonry/Masonry.h>
@implementation UIView (CornerRadius)
- (void)addCornerRadius5 {
    UIImageView *mask = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"diaryCoverMask"]];
    mask.userInteractionEnabled = NO;
    [self.superview addSubview:mask];
    [mask mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}

- (void)containerRectCorner:(CGSize)cornerRadii byRoundingCorners:(UIRectCorner)corners {
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:cornerRadii];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.bounds;
    maskLayer.path = maskPath.CGPath;
    self.layer.mask = maskLayer;
}

@end
