THCircularProgressViewiOS 圓形進度條
THCircularProgressView 是一個 iOS 的圓形的進度條。
用法
THCircularProgressView只是一個UIView子類,因此只需實例化它,然后將其添加為視圖層次結(jié)構(gòu)。初始化程序是:
- (instancetype)initWithCenter:(CGPoint)center
radius:(CGFloat)radius
lineWidth:(CGFloat)lineWidth
progressMode:(THProgressMode)progressMode
progressColor:(UIColor *)progressColor
progressBackgroundMode:(THProgressBackgroundMode)backgroundMode
progressBackgroundColor:(UIColor *)progressBackgroundColor
percentage:(CGFloat)percentage
您也可以使用標準-[UIView initWithFrame:(CGRect)frame]。
它支持兩種進度模式:
-
THProgressModeFill-開始為空,并隨著百分比的增加而被填充;(默認) -
THProgressModeDeplete-開始充滿并隨著百分比的增加而耗盡;
還可以設(shè)置一個標簽,以顯示進度視圖表示的數(shù)字。例如:
THCircularProgressView *progress = ...; CGFloat percentage = 0.3f; progress.centerLabel.text = [NSString stringWithFormat:@"%.0f", percentage * 100.0f]; progress.centerLabelVisible = YES; // needed since label is invisible by default
其中的示例項目/Demo包含一些示例。
評論
圖片
表情
