在for循环内更新UIProgressView

| 我已经搜索了问题,唯一的提示是performSelectorOnMainThread解决方案。我这样做了,但是在for循环运行时视图没有更新。循环后,进度值可以正确显示-但这不是\``Progress \''View =的意义 for循环在控制器内。我调用一个方法来设置进度值:
CGFloat pr = 0.5; // this value is calculated
[self performSelectorOnMainThread:@selector(loadingProgress:) withObject:[NSNumber numberWithFloat:pr] waitUntilDone:NO];
这是加载进度方法
-(void)loadingProgress:(NSNumber *)nProgress{
    NSLog(@\"Set Progress to: %@\", nProgress);
    [[self progress] setProgress:[nProgress floatValue]];
}
我还尝试通过在方法顶部使用以下方法将带有for循环的方法放入后台线程:
    if([NSThread isMainThread]) {
        [self performSelectorInBackground:@selector(importData) withObject:nil];
        return;
    }
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
也许有人可以帮我这个忙。     
已邀请:
 CGFloat pr = 0.5; // this value is calculated
[self performSelectorInBackground:@selector(loadingProgress:) withObject:[NSNumber numberWithFloat:pr]];
试试这个来设置进度值     

要回复问题请先登录注册