我想在下载一些数据(同步)时查看进度,但我的 UIView 子类(自定义进度视图)在下载完成之前不会显示。这是一些代码:
self.progressView.hidden = NO;
// I would expect the progressView to show up now
// but it doesn't
int i = 0;
for (Something *something in someList) {
if (something...) {
i++;
// do something
// start downloading some data
NSString *urlPath = [NSString stringWithFormat:@"somePath"];
NSURL *aURL = [NSURL URLWithString:urlPath];
NSData* responseData = [NSData aURL];
// parse out the JSON data
NSError* error = nil;
NSArray* json = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
for (NSDictionary *currentObject in json) {
// do some stuff
}
}
}
// the progressView does show up here... why?
我在下载任何内容之前更改为非隐藏的进度视图在所有下载完成后显示。为什么呢?以及如何在所有下载内容之前显示 progressView?