我搜索了很多论坛,但没有找到,我的问题是
我需要从网络上预加载一些数据以加载到 UITableView。
我看到一些应用程序解决了这个问题,当显示 UITableView 时,它们将“等待圆圈”显示为模态视图,并且在加载数据后只是隐藏这个圆圈。
- 有没有简单的解决方案来做到这一点?
- 我需要做什么?
- 我需要什么样的请求:同步还是异步?
- 如何显示这个圈子,我需要显示animatedGif还是有一些内部/外部控制?
我搜索了很多论坛,但没有找到,我的问题是
我需要从网络上预加载一些数据以加载到 UITableView。
我看到一些应用程序解决了这个问题,当显示 UITableView 时,它们将“等待圆圈”显示为模态视图,并且在加载数据后只是隐藏这个圆圈。
- (void)showWaitingView {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGRect frame = CGRectMake(90, 190, 32, 32);
UIActivityIndicatorView* progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame];
[progressInd startAnimating];
progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
frame = CGRectMake(130, 193, 140, 30);
UILabel *waitingLable = [[UILabel alloc] initWithFrame:frame];
waitingLable.text = @"Processing...";
waitingLable.textColor = [UIColor whiteColor];
waitingLable.font = [UIFont systemFontOfSize:20];;
waitingLable.backgroundColor = [UIColor clearColor];
frame = [[UIScreen mainScreen] applicationFrame];
UIView *theView = [[UIView alloc] initWithFrame:frame];
theView.backgroundColor = [UIColor blackColor];
theView.alpha = 0.7;
theView.tag = 999;
[theView addSubview:progressInd];
[theView addSubview:waitingLable];
[progressInd release];
[waitingLable release];
[window addSubview:[theView autorelease]];
[window bringSubviewToFront:theView];
[pool drain];
}
- (void)removeWaitingView {
UIView *v = [window viewWithTag:999];
if(v) [v removeFromSuperview];
}