0

I have two methods. One method is used to load my SVProgressHUD, the second method is used to get data from my coreData and sort it then present it in a new UITableView. The user selects are UITableViewCell which calls:

didSelectRowAtIndexPath

Then I have two method calls in this, the first is:

[self loadHUD];

This method loads a hud (which never shows if I implement the second method in didSelectRowAtIndexPath). This is the second method:

[self loadAndSortArray];

When I call this for some reason it is preventing the SVProgressHud from ever appearing, however if I remove this method call then the hud loads fine.

I would like to know how I can have both methods but display the hud before the second method starts ?

4

1 回答 1

2

所有视图都在主线程中刷新,如果您不将昂贵的进程loadAndSortArray放在后台线程中,这会发生在您身上。

您可以将该方法放入:

dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
    [self loadAndSortArray];
});
于 2013-10-30T23:00:45.187 回答