//
//  GovLineView.m
//  Open
//
//  Created by 雷俊博 on 2021/7/20.
//  Copyright © 2021 黄江涛 . All rights reserved.
//

#import "GovLineView.h"

@implementation GovLineView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        [self drawCornerView];
    }
    return self;
}

- (void)drawCornerView
{
    //
    CGFloat viewWidth = self.bounds.size.width;
    CGFloat viewHeight = self.bounds.size.height;
    
    
    UIBezierPath *path = [UIBezierPath bezierPath];
    
    //首先设置一个起始点
    CGPoint startPoint = CGPointMake(0, viewWidth/2);
    [path moveToPoint:startPoint];
    [path addArcWithCenter:CGPointMake(viewWidth/2, 0) radius:viewWidth/2 startAngle:-M_PI endAngle:0 clockwise:YES];
    [path addLineToPoint:CGPointMake(viewWidth, viewHeight - viewHeight/2)];
    [path addArcWithCenter:CGPointMake(viewWidth/2, viewHeight) radius:viewWidth/2 startAngle:0 endAngle:M_PI clockwise:YES];
    [path addLineToPoint:startPoint];
    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
    shapeLayer.path = path.CGPath;
    shapeLayer.strokeColor = [UIColor clearColor].CGColor;
    shapeLayer.fillColor = [UIColor colorWithHex:0x4d4d4d].CGColor;
    shapeLayer.borderWidth = 2.0;
    [self.layer addSublayer:shapeLayer];
    

    
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
