Custom progress bar
/** Initialize a progress, the size of the outer layer of aFrame. The color of the outer layer of aFrameColor is the gap between the color of the outer layer and the color of the outer layer. **/-(id) initWithFrame :( CGRect) aFrame frameColor :( UIColor *) aFrameColor barColor :( UIColor *) aBarColor aFrameCornerRadius :( CGFloat) aFrameCornerRadius border :( CGColorRef) Background gapSize :( CGFloat) gapSize {self = [super initWithFrame: aFrame]; if (self) {self. backgroundColor = [UIColor clearColor]; _ Gap = gapSize; _ outter = [[UILabel alloc] init]; _ outter. frame = self. bounds; _ outter. backgroundColor = aFrameColor; _ outter. layer. borderWidth = 1; _ outter. layer. borderColor = aFrameBorderColor; [self addSubview: _ outter]; _ inner = [[UILabel alloc] init]; _ inner. frame = CGRectZero; _ inner. backgroundColor = aBarColor; [self addSubview: _ inner]; _ inner. layer. cornerRadius = aFrameCornerRadius-gapSize; _ Inner. layer. masksToBounds = YES; _ outter. layer. cornerRadius = aFrameCornerRadius; _ outter. layer. masksToBounds = YES;} return self;}-(void) setProgress :( float) progress {progress = progress <0? 0: progress; progress = progress> 1? 1: progress; _ inner. frame = CGRectMake (_ gap, _ gap, progress * (self. frame. size. width-_ gap * 2.0), self. frame. size. height-_ gap * 2.0);}-(void) dealloc {[_ inner removeFromSuperview]; [_ outter removeFromSuperview];}