2016-10-20 15 views
0

Я пытаюсь отобразить представление, потому что метод занимает несколько секунд. Тем не менее, загрузка UIWindow фактически не становится ключевым и видимым до тех пор, пока весь метод не будет завершен. Любая идея, что здесь происходит?UIWindow не отображается, пока метод не завершится

// this line creates a uiwindow with view controller as root view controller, an activity indicator, and a label and makes the loading view key and visible 
[XSELLoadingView presentLoadingViewWithTitle:@"Generating Report"]; // use loading view for long times 

// these three lines process a lot of data and present the view on the main window 
XSELCount *startCount = [[XSELCount counts] objectAtIndex:[self.startingPick selectedRowInComponent:0]]; 
XSELCount *endCount = [[XSELCount counts] objectAtIndex:[self.endingPick selectedRowInComponent:0 
[self.navigationController pushViewController:[XSELReportView viewWithReportData:[XSELReportData compareStartCount:startCount toEndCount:endCount]] animated:false]; 

// this line makes the main view key and visable 
[XSELLoadingView dismissLoadingView]; 
+0

Для уточнения XSELLoadingView представляет собой окно с представлением, а не только представление поверх текущего окна. – Scott

+2

Вам нужно выполнить длительную обработку в фоновом режиме. – rmaddy

ответ

0

Примените вашу задачу в этом поле.

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 
    //Do background work 
    dispatch_async(dispatch_get_main_queue(), ^{ 
     //Update UI 
    }); 
});