[英]Capturing one image after processing another on iphone
I am trying to implement some image processing on iPhone. 我正在尝试在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. 我在captureStillImageAsynchronouslyFromConnection()中调用的句柄的末尾发布了一个通知,以便在代码完成处理后,它通过通知中心调用下一步。
Here are examples on custom notifications and I basically followed it. 这是有关自定义通知的示例 ,我基本上遵循了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.