UIProgressView進度條方法總結

初始化一個進度條:

  • (instancetype)initWithProgressViewStyle:(UIProgressViewStyle)style;
    注意:1.用這個方式初始化的進度條系統會默認給一個長度。

     2.進度條的長度可以通過frame來設置,但是隻有前三個參數有效。
    
     3.風格枚舉如下:
    

1
2
3
4
typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
UIProgressViewStyleDefault, // 普通樣式
UIProgressViewStyleBar, // 用於工具條的樣式
};

設置進度條風格樣式

@property(nonatomic) UIProgressViewStyle progressViewStyle;

設置進度條進度(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;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章