In UIView
I have taken one UIProgressView
to show the Progress of the data downloaded from the server and to show those data I have taken an UITableView
. The web service is via Polling, so which data is loading, I am loading it into an UITableView
. But when user is scrolling the UITableView
the ProgressBar
paused its progress, but when again I am stopping my manual scroll of UITableView
that time again the Progress bar is starting its progress from last paused position.
Code which I have Written:
Taken an outlet:
IBOutlet UIProgressView *pgrsVw;
When I am starting my web service call:
pgrsVw.progress = 0.0;
pgrsVw.hidden=false;
[self performSelectorOnMainThread:@selector(makeMyProgressBarMoving) withObject:nil waitUntilDone:NO];
Now to show the Progress:
- (void)makeMyProgressBarMoving
{
float actual = [pgrsVw progress];
if (actual < 1)
{
pgrsVw.progress = actual + PROGRESSOFDATA;
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(makeMyProgressBarMoving) userInfo:nil repeats:NO];
}
else
{
pgrsVw.progress=1.0;
pgrsVw.hidden=true;
}
}
Now when the data downloading is completed:
pgrsVw.progress=1.0;