NSThread
2015-11-23 10:08
134 查看
/**
* 更新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];
}
}
}
* 更新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];
}
}
}
相关文章推荐
- 内存分析工具 MAT 的使用
- jQuery中10个非常有用的遍历函数
- 制作DIP Package及DIP焊盘制作,不规则焊盘制作
- XSS跨站点脚本攻击
- Ubuntu14.04.3 64位环境下openjdk7编译
- 同一局域网内怎样获取新来美眉QQ号码!((*^__^*) 嘻嘻……)
- 什么是好的开发者?
- Visifire实现统计图
- SOJ 2818_QQ音速
- VSS Invalid Handle 登录时的问题
- SOJ 2818_QQ音速
- 我的书单
- 类型
- 使用jquery实现鼠标滑过弹出更多相关信息层附源码下载
- 华为OJ基础篇-iNOC产品部–完全数计算
- Java String.getChars()
- spring + redis 实现数据的缓存
- ios 64位下编译webrtc的libvpx库出现错误Bad cputype for object file.Currently only tested for CPU_TYPE_x86_64
- 平安医保权限管理关系
- 修改servlet的模板代码