Search code examples
iosobjective-cnsthreadnsoperationqueue

iOS running multiple operations in a thread


I am new to threads in iOS Development, i have question here consider the following code

   [activityIndicator startAnimating];
   [self startAnewOperationInSepThread];
   [self startAnotherOperationInSepThread];

My understanding here is when the first line is executed the activity indicator will be started in the main thread. So now the main thread is responsible for running the activity indicator. How the subsequent Operations will be invoked.


Solution

  • No. When the first line is executed the activity indicator is not started. It will be started as soon as your method in main thread invoked by main loop ends. While your method is running in main thread, nothing will change for UI.