2013-09-27 76 views

回答

1
在viewDidLoad中

self.view.hidden = YES; 
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 
    // do your background tasks here 
    [self doSomethingInBackground]; 

    // when that method finishes you can run whatever you need to on the main thread 
    dispatch_async(dispatch_get_main_queue(), ^{ 
     self.view.hidden = NO; 
    }); 
}); 

(改編自Implement a block in background, then after completion run another block on main thread?

0

將在後臺線程任務,當完成這刷新主線程加載筆尖。

請記住,iOS應用程序中的視圖在主線程中運行,如果您正在執行一項任務並且沒有快速完成,最好的方法是在後臺運行任務。