星空网 > 软件开发 > 操作系统

自定义的进度条

自定义的进度条images/loading.gif' data-original="http://images2015.cnblogs.com/blog/815558/201604/815558-20160414115925770-181459435.png" />

/** 初始化一个progress, aFrame          外层的大小 aFrameColor     外层的颜色 aBarColor        里层的颜色 gapSize          里层和外层的间隙 **/- (id)initWithFrame:(CGRect)aFrame frameColor:(UIColor *)aFrameColor barColor:(UIColor *)aBarColor aFrameCornerRadius:(CGFloat)aFrameCornerRadius aFrameBorderColor:(CGColorRef)aFrameBorderColor 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];}

 




原标题:自定义的进度条

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

中环运国际物流:https://www.goluckyvip.com/tag/49323.html
中环转运:https://www.goluckyvip.com/tag/49324.html
中集小飞鱼物流:https://www.goluckyvip.com/tag/49326.html
中技物流:https://www.goluckyvip.com/tag/49327.html
中佳联供应链:https://www.goluckyvip.com/tag/49328.html
中间汇率:https://www.goluckyvip.com/tag/49329.html
温州旧货市场有玻璃柜卖吗?:https://www.vstour.cn/a/411246.html
如何用摄影作品表现“芳草鲜美,落英缤纷”的:https://www.vstour.cn/a/411247.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流