Pergunta

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];
}
Foi útil?

Solução 2

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

Outras dicas

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
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top