简体   繁体   English

使用AVCaptureDevice扫描图像后立即进行筛选

[英]Immediately Segue After Scanning an Image with AVCaptureDevice

My view scans a barcode then segues to another view where it loads info from a website about the barcode. 我的视图扫描条形码,然后选择另一个视图,在该视图中从网站加载有关条形码的信息。 My problem is that after scanning the the screen freezes instead of immediately segueing to the new view where it would show a loading indicator until the data loaded. 我的问题是扫描后屏幕冻结,而不是立即锁定到新视图,在该视图中它将显示加载指示器,直到加载数据为止。 The segue only happens AFTER all the information has loaded or has failed to load etc. How can I get this transition to happen? 只有在所有信息都已加载或加载失败之后,才会发生segue。如何使这种转换发生?

You are trying to do this processing on the main thread, I'd bet. 我敢打赌,您正在尝试在主线程上执行此处理。 Read up on Grand Central Dispatch so you can offload this work onto a background thread, leaving your UI responsive. 阅读Grand Central Dispatch,以便您可以将此工作卸载到后台线程上,从而使UI保持响应状态。

(If you post code we can be more specific...) (如果您发布代码,我们可以更具体...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM