一个自定义视图组件,允许用户轻松地呈现一个带有透明通道图像(例如 PNGs)的进度视图。视图的进度可以动画化;可以自定义前景色和背景色,以及动画持续时间。
使用很简单。
将依赖项添加到您的 `Podfile
platform :ios
pod 'TWRProgressView'
...
运行 pod install
安装依赖项。
然后,将头文件导入到您想使用选择器的任何地方
#import "TWRProgressView.h"
进度视图可以通过 Interface Builder(XIB 和 Storiesداور)设置,只需将 TWRProgressView 设置为任何 UIView 的类...
@property (weak, nonatomic) IBOutlet TWRProgressView *progressView;
...
UIImage *someImage = [UIImage imageNamed:@"image.png"];
[_progressView setMaskingImage:someImage];
... 或使用简洁的单行代码以编程方式设置
CGRect progressViewRect = CGRectMake(0, 0, 100, 100);
UIImage *someImage = [UIImage imageNamed:@"image.png"];
TWRProgressView *progressView = [TWRProgressView progressViewWithFrame:progressViewRect
andMaskingImage:someImage];
[self.view addSubview:progressView];
TWRProgressView 提供以下方法,允许用户自定义颜色、进度和动画时间
- (void)setProgress:(CGFloat)progress;
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;
- (void)setBackColor:(UIColor *)backColor;
- (void)setFrontColor:(UIColor *)frontColor;
- (void)setAnimationTime:(CGFloat)time;
TWRProgressView
需要 iOS 6.x 或更高版本。
使用受 MIT 许可证 提供。有关详细信息,请参阅 LICENSE。