/**
* 更新UI界面 即进度条的进度
*/
-(void)updateUI
{
self.progressView.progress+=0.01;
NSLog(@"%f",self.progressView.progress);
}
/**
* 开始线程
*/
-(void)start
{
NSThread *thread=[[NSThread alloc] initWithTarget:self selector:@selector(incrementProgress) object:nil];
[thread start];
// NSLog(@"%@",[NSThread currentThread]);
}
/**
* 开启线程后调用
每隔0.05秒调用一次updateUI方法
*/
-(void)incrementProgress
{
if(self.progressView.progress!=1.00){
for (int i=0; i<=100; i++) {
[NSThread sleepForTimeInterval:0.05];
[self performSelectorOnMainThread:@selector(updateUI) withObject:nil waitUntilDone:YES];
}
}
}