Hey, I have a problem in Multithreading.
To describe this, I have two threads.
On main thread I have some logic
And on another thread, I have a logic and some logic to UI which will update UI.
What I want to do is that I want to call some method after the UI on another thread is updated.
I think I am supposed to use NSOperationQueue or something. or background queue.
but I have read the concurrency programming and threading guide and I still have no idea how to do it.
So how to do it so that I can call a method after a thread is finished?
thanks!
You should never touch the UI from any thread other than the main thread. Two easy ways of sending messsages between threads:
performSelector:
Notifications:
You can of course also use an NSOperationQueue and Key-Value-Observe the job’s finished property, but unless you’d need it for other reasons it just adds unnecessary complexity.