0

I search for a lot forums but nothing found, my problem is that

I need preload some data from the web to load to the UITableView.

I saw some apps solved this problem, when show UITableView they shows "waiting circle" as modal view and after data is loaded just hide this circle.

  1. Is there simple solution to do this?
  2. What I need to do?
  3. What kind of Request do I need: synchronius or asynchronius?
  4. How to show this circle, do I need to show animatedGif or there is some internal/external control for this?
Luft-on
  • 179
  • 1
  • 13

2 Answers2

0

You need to make a NSThread for your "waiting circle"-(Activity Indicator).

1)Threads How do I create an NSThread that isn't the main thread.

2)Activity Indicator How to use activity indicator view.

Community
  • 1
  • 1
Dream.In.Code
  • 399
  • 3
  • 5
0
 - (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];

}
Prabhjot Singh Gogana
  • 1,408
  • 1
  • 14
  • 39