先上个效果图,哈~
我是使用mask蒙版的,写的丑莫怪
#import "ECMicShapeView.h"
@interface ECMicShapeView(){
CGFloat _recHeight;
CAShapeLayer *_maskLayer;
CALayer *_fillLayer;
}
@property (nonatomic, assign) CGFloat lineWidthKM;
@property (nonatomic, nullable) UIColor *colorKM;
@end
@implementation ECMicShapeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initDefault];
[self paint];
}
return self;
}
- (void)initDefault {
_recHeight = self.frame.size.height;
self.lineWidthKM = 3;
self.colorKM = [UIColor whiteColor];
self.backgroundColor = [UIColor orangeColor];
}
- (void)paint {
//
UIBezierPath *linePath = [UIBezierPath bezierPath];
[line