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