经常会遇到需要自定义进度条的需要,那么使用以下的小demo可以实现
.m文件
#import “GGProgressView.h”
@interface GGProgressView()
{
UIView *_progressView;
float _progress;
float _width;
float _heigth;
}
@end
@implementation GGProgressView
-(instancetype)initWithFrame:(CGRect)frame
{
return [self initWithFrame:frame progressViewStyle:GGProgressViewStyleDefault];
}
- (instancetype)initWithFrame:(CGRect)frame progressViewStyle:(GGProgressViewStyle)style
{
if (self=[super initWithFrame:frame]) {
_progressView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, frame.size.height)];
_progress=0;
self.progressViewStyle=style;
[self addSubview:_progressView];
}
return self;
}
-(void)setProgressViewStyle:(GGProgressViewStyle)progressViewStyle
{
_progressViewStyle=progressViewStyle;
if (progressViewStyleGGProgressViewStyleTrackFillet) {
self