第六篇 - UIProgressView
初始化
UIProgressView *pro = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
//NS_ASSUME_NONNULL_BEGIN
//
@class UIImageView, CAGradientLayer;
//
//typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
// UIProgressViewStyleDefault, // normal progress bar
// UIProgressViewStyleBar __TVOS_PROHIBITED, // for use in a toolbar
//};
//
//NS_CLASS_AVAILABLE_IOS(2_0) @interface UIProgressView : UIView <NSCoding>
//
//只有前三个参数是有用的
- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
//创建一个带有默认风格的进度条(默认风格如下)
//typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
// UIProgressViewStyleDefault, // 普通样式
// UIProgressViewStyleBar, // 用于工具条的样式
//};
- (instancetype)initWithProgressViewStyle:(UIProgressViewStyle)style; // sets the view height according to the style
//设置默认风格
@property(nonatomic) UIProgressViewStyle progressViewStyle; // default is UIProgressViewStyleDefault
//设置进度值[0.0,1.0]
@property(nonatomic) float progress; // 0.0 .. 1.0, default is 0.0. values outside are pinned.
//已经走过的颜色
@property(nonatomic, strong, nullable) UIColor* progressTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
//没有走过的颜色
@property(nonatomic, strong, nullable) UIColor* trackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
//设置进度条已走过进度的背景图案和为走过进度的背景图案(IOS7后好像没有效果了)
@property(nonatomic, strong, nullable) UIImage* progressImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
@property(nonatomic, strong, nullable) UIImage* trackImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
//
// 设置进度值,带有平滑过渡效果
- (void)setProgress:(float)progress animated:(BOOL)animated NS_AVAILABLE_IOS(5_0);
//
//看起来非常厉害啊 http://www.cocoachina.com/industry/20140522/8518.html
@property(nonatomic, strong, nullable) NSProgress *observedProgress NS_AVAILABLE_IOS(9_0);
//
@end