<<<<<<< HEAD
首先导入类库 #import <TLProgressSpring/TLNavBarProgressView.h>
键入代码
TLNavBarProgressView *progressView = [TLNavBarProgressView progressViewforNavigationController:self.navigationController];
progressView.progressTintColor=[UIColor redColor];
_progress+= 0.2;
if(_progress>=1){
_progress=0;
}
[progressView setProgress:_progress animated:YES];
导入类库 #import <TLProgressSpring/TLActivityIndicatorView.h>
_activityIndicatorView = [[TLActivityIndicatorView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:_activityIndicatorView];
_activityIndicatorView.animatorDuration = 0.8;
[_activityIndicatorView startAnimating];
启动:
-(void)showActivity:(id)sender{
if(_activityIndicatorView){
[_activityIndicatorView startAnimating];
}
}
导入类库 #import <TLProgressSpring/TLOverlayProgressView.h>
首先利用 Block 定义一个延时关闭的方法
- (void)performBlock:(void(^)())block afterDelay:(NSTimeInterval)delay {
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), block);
}
-(void)onShowProgress0{
TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
showOverlayAddTo:[self rootView]
title:nil
style:TLOverlayStyleIndeterminate
animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView hideAnimated:YES];
}];
[overLayProgress showAnimated:YES];
[self performBlock:^{
[overLayProgress dismiss:YES];
} afterDelay:2.0];
}
-(void)onShowProgress1{
TLOverlayProgressView *overlayProgress=[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"Failier" style:TLOverlayStyleCrossIcon animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView hideAnimated:YES];
}];
[overlayProgress showAnimated:YES];
[self performBlock:^{
[overlayProgress dismiss:YES];
} afterDelay:2.0];
}
-(void)onShowProgress2{
TLOverlayProgressView *overlayProgress=[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"Success" style:TLOverlayStyleCheckmarkIcon animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView hideAnimated:YES];
}];
[overlayProgress showAnimated:YES];
[self performBlock:^{
[overlayProgress dismiss:YES];
} afterDelay:2.0];
}
-(void)onShowProgress3{
TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
showOverlayAddTo:self.view
title:@"loading"
style:TLOverlayStyleHorizontalBar
animated:YES];
overLayProgress.isShowPercent=YES;
[overLayProgress showAnimated:YES];
[self simulateProgress:overLayProgress];
}
-(void)onShowProgress4:(TLOverlayStyle )style{
TLOverlayProgressView *progress = [TLOverlayProgressView showOverlayAddTo:self.view
title:@"loading..."
style:TLOverlayStyleIndeterminateSmall
animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView dismiss:YES];
}];
[self performBlock:^{
[progress dismiss:YES];
} afterDelay:2.0];
}
-(void)onShowProgress5{
TLOverlayProgressView *overlayProgressView =[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"" style:TLOverlayStyleDeterminateCircular animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView hideAnimated:YES];
}];
[overlayProgressView showAnimated:YES];
[self simulateProgress:overlayProgressView];
}
-(void)onShowProgress7{
TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
showOverlayAddTo:self.view
title:@"Loading..."
style:TLOverlayStyleSystemUIActivity
animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
[progressView hideAnimated:YES];
}];
[overLayProgress showAnimated:YES];
[self performBlock:^{
[overLayProgress dismiss:YES];
} afterDelay:2.0];
}
要运行示例项目,首先克隆仓库,然后从示例目录运行 pod install
TLProgressSpring 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行
pod "TLProgressSpring"
Andrew, [email protected]
一款进度条工具类,可以在导航栏上显示,也可以弹出一个转轮显示,用户随时可交互
e7a0f294260c4687ab69a6d47ec40498dcee80bc