0

Strange things are happening here. Im working on a project which has a tableviewcontroller. The headersview are from a custom class which add a progressview and a button. When the button is clicked the progressview shows the download status en removes itself from the screen when done. Here is the problem.

The progressview isn't showing nor is it showing its progress (blue color). When I set the backgroundcolor to black I do see a black bar with no progress. Even when I set the progress to a static 0.5f. Im also working with revealapp which shows the progressviews frame but not the trackingbar.

So the progressview is physically there but just not visible. Does anybody know why?

Structure:

Header.m

init:

[[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]

layoutSubviews:

CGRectMake(x, x, x, x);

Then:

- (void)synchMedia
{
     // add progressview to view
     [self performSelectorInBackground:@selector(synchMediaThread) withObject:nil];
}


- (void)synchMediaThread
{
     // Do all the heavy lifting
     // set progressview progress

     // loop this:
     [self performSelectorOnMainThread:@selector(updateProgressView:) withObject:progress waitUntilDone:YES];
     // finally
     [self performSelectorOnMainThread:@selector(synchDone:) withObject:@(numFailed) waitUntilDone:YES];
}

When done:

- (void)synchDone {
     // remove progressview
     [tableview reloadData];
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Mark Molina
  • 5,057
  • 8
  • 41
  • 69
  • Where do you show the progressView? Could you give some code? – Larme Apr 17 '14 at 09:33
  • I edited my question with the basic structure. Note that I said that even statically adding the progressview to the view and setting the progress to 50% without doing anything with doesn't show the progressview as well. – Mark Molina Apr 17 '14 at 10:19
  • It's not on a UIAlertView, right? – Larme Apr 17 '14 at 10:28
  • lol. No its a UIProgressView – Mark Molina Apr 17 '14 at 11:27
  • Here are some link related to UIProgessView might help you out [link1](http://www.ioscreator.com/tutorials/display-a-progress-bar) and [link2](http://stackoverflow.com/questions/7412795/how-to-use-the-progress-bar-in-the-iphone-app) – nikhil84 Apr 17 '14 at 11:45

2 Answers2

1

Have you downloading any large data? If so then in that case updation on UI get blocked as main thread get busy.

To check this just add NSLog statement in a function which is calculating the progress of downloading. in this case it will log the progress on console but not on UI. If you get the correct progress on console then it is sure that UI updation is blocking when you start downloading.

Try to use some delay to update the UI or

dispatch_async(dispatch_get_main_queue(), ^{
//do you code for UI updation
});
svrushal
  • 1,612
  • 14
  • 25
  • Nope sorry not the problem. I added a basic structure to my question which shows the main flow. Note that I said that even statically adding the progressview to the view and setting the progress to 50% without doing anything with doesn't show the progressview as well. – Mark Molina Apr 17 '14 at 10:21
  • Add NSLog in updateProgressView: function. Check for the printing of calculated values. Does it showing right values? – svrushal Apr 17 '14 at 10:35
0

The problem was with the way the UIView was used in the tableview delegate.

Mark Molina
  • 5,057
  • 8
  • 41
  • 69