一个比较易懂的自定义进度条分享给大家,这个是转发海丽的,再次谢过原作者
下面贴出地址:http://blog.csdn.net/rhljiayou/article/details/9699759
工具类下载地址也写出来 :http://download.csdn.net/detail/rhljiayou/5870535
我把用法写出来
导入CustomProgress.h和.m文件项目中
用法:
#import <UIKit/UIKit.h>
#import "CustomProgress.h"
@interface ProgressViewController :UIViewController<CustomProgressDelegate>
{
UILabel *label;
}
@end
- (void)viewDidLoad
{
[superviewDidLoad];
//添加进度条
CustomProgress *customProgress = [[CustomProgressalloc]initWithFrame:CGRectMake(10,10, 300,40)];
customProgress.delegate =self;
//设置进条值
[customProgress setProgress:100];
[self.viewaddSubview:customProgress];
label = [[UILabelalloc]initWithFrame:CGRectMake(10,60, 300,40)];
label.textAlignment =NSTextAlignmentCenter;
label.text =@"0";
[self.viewaddSubview:label];
// Do any additional setup after loading the view from its nib.
}
#pragma CustomeProgressDelagate
-(void)changeTextProgress:(NSString *)string
{
//标签上显示进度
label.text = string;
}
-(void)endTime
{
//进度完成时,做某些处理
}