I am trying to implement some image processing on iPhone. The program should work as following:
The problem I have in this task is that I don't know how to force these tasks to be run sequentially (taking the next step only after the last one is finished). I can only find the
captureStillImageAsynchronouslyFromConnection()
method to capture an image, which seems to run in the same thread in where it is called. As a result, I cannot call
[NSThread sleepForTimeInterval:sometime]
to wait then check if the processing is completed without "sleeping" the processing as well.
Is there something else I can do to achieve the task, or do I have to use explicit threading myself?
I came up with a solution using notifications, and it works nicely. I post a notification at the end of the handle invoked in captureStillImageAsynchronouslyFromConnection(), so that when the code finishes processing, it calls in the next step through the notification center.
Here are examples on custom notifications and I basically followed it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.