Question

my main UIViewController should check for some data updates when it loads, if any update is found an opaque subview is added to show progress and so on.

Let's say that the method is called checkUpdates, so in my app delegate i do the following:

[window addSubview:viewController.view];
[window makeKeyAndVisible];

[viewController checkUpdates];

The method is like

- (void) checkUpdates {
    // add the opaque progress view
    [self.view addSubview:progress.view];
    [progress setMessage: @"Checking for updates ..."];

    // ... perform the update ...

    // remote the progress view
    [progress.view removeFromSuperview];
}

Theoretically the view should load and the update process should be seen, but the problem is that the view just get freezed during this phase, and when the update process is finished i'm able to interact with it.

Any idea?

Was it helpful?

Solution

Since the UI runs on the main thread of the app, if you perform "work" tasks on the main thread, you will also block the UI, which will therefore look frozen.

You might want to consider using NSOperationQueue or something equivalent to spin off another thread to do your work so the UI can continue to process updates independently.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top