Progress HUD showing too late

| | August 8, 2015

I am currently loading a new view dynamically by evaluating the segue.identifier in the prepareForSegue:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([segue.identifier isEqualToString: @"DetailViewSegue"]) {
        DetailViewController *detailController = segue.destinationViewController;
        // ... do something with the controller
    }
}

Some of those views need a bit of time because gathering the data from the Internet and displaying that in a table scheme needs a rather long time.
Therefore I want to display a Progress HUD like KVNProgress, however the main issue now is that the Progress bar shows up too late, right before the new view is ready. As far as I have seen is the main Problem, that the prepareForSegue method and therefore the KVNProgress was called immediately before loading all the data, but loading a new view seems to be preferred instead.

Another thing I tried was to call KVNProgress within a IBAction or didSelectRowAtIndexPath and to call the performSegueWithIdentifier within his own thread. However this is (as the console output suggests) discouraged, and does not really work either.

Thanks!

Leave a Reply