1.初始化
初始化一個(gè)進(jìn)度條:
- (instancetype)initWithProgressViewStyle:(UIProgressViewStyle)style;
注意:1.用這個(gè)方式初始化的進(jìn)度條系統(tǒng)會(huì)默認(rèn)給一個(gè)長(zhǎng)度贷币。
2.進(jìn)度條的長(zhǎng)度可以通過(guò)frame來(lái)設(shè)置击胜,但是只有前三個(gè)參數(shù)有效。
3.風(fēng)格枚舉如下:
typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
UIProgressViewStyleDefault,? ? // 普通樣式
UIProgressViewStyleBar,? ? ? ? // 用于工具條的樣式
};
設(shè)置進(jìn)度條風(fēng)格樣式
@property(nonatomic) UIProgressViewStyle progressViewStyle;
2.其他設(shè)置
設(shè)置進(jìn)度條進(jìn)度(0.0-1.0之間役纹,默認(rèn)為0.0)
@property(nonatomic) float progress;
設(shè)置已走過(guò)進(jìn)度的進(jìn)度條顏色
@property(nonatomic, retain) UIColor* progressTintColor;
設(shè)置未走過(guò)進(jìn)度的進(jìn)度條顏色
@property(nonatomic, retain) UIColor* trackTintColor;
設(shè)置進(jìn)度條已走過(guò)進(jìn)度的背景圖案和為走過(guò)進(jìn)度的背景圖案(IOS7后好像沒(méi)有效果了)
@property(nonatomic, retain) UIImage* progressImage;
@property(nonatomic, retain) UIImage* trackImage;
設(shè)置進(jìn)度條進(jìn)度和是否動(dòng)畫(huà)顯示(動(dòng)畫(huà)顯示會(huì)平滑過(guò)渡)
- (void)setProgress:(float)progress animated:(BOOL)animated;
3.實(shí)例