另一种情况 - 加载演示文稿 [英] Another Situation - Loading Presentation

查看:117
本文介绍了另一种情况 - 加载演示文稿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的移动应用主题就像移动设备中的默认图库应用程序一样,应用了一些隐私设置。所有逻辑都已完成并且运行良好。但是,应用理想演示时面临的问题。当项目写入应用程序路径时,我们想要呈现UIActivityIndi​​catorview / MBProgressHud(来自Github),在app路径中创建的文件夹之间移动项目。



请参阅设计:



//开始加载动画

for(item in items []){

//逻辑代码:

//将项目写入应用程序路径的代码(类似于NSData的资产类型)

//或用于在app路径中的文件夹之间移动项目的代码

//处理完最后一项后停止动画

}



然而,动画很快停止,因为我们知道同步发生文件操作和剩余编译。但是,我的应用程序需要一些演示来定义用户必须等到给定的操作未完成。



*我能为此要求做些什么?

*如果GCD是方便的工具,GCD类型对我有用吗?



英文太弱了。请调整。



注意:项目是指照片和视频。

My mobile app theme is just like default Gallery application in the mobile with some privacy settings applied. All logic's are done and works well. But, the problem facing when applying ideal presentation. We want to presenting the UIActivityIndicatorview / MBProgressHud(from Github) when the item's write to app path, move the items between folder which created in app path.

See design:

// start animation for loading
for(item in items[]){
// logic code:
// code for write items to app path(like asset type to NSData)
// or code for moving item's between folder which is in app path
// stop animation after handle last item
}

However, the animation stopped quickly because we know that the file operation and remaining compilation synchronously happened. BUT, my app wants some presentation to defining the user must wait until the given operation not complete.

* What could i do for this requirements?
* If the GCD is handy tool means, which GCD type is helpful for me?

Am too weak in English. Please adjust.

NOTE: Item's means Photo's and video's.

推荐答案

我的建议是< br $> b $ b

- 开始动画

- 启动工作线程完成所有工作

- 工作线程发出信号作业完成后,这将停止动画。



以下是 Ray Wenderlich 。 addOperationWithBlock调用看起来像是taylored。



我更喜欢GCD更多用于C-API并尝试使用Cocoa类来避免它。
My advice would be to

- start animation
- start a worker thread which does all the work
- the worker thread is signaling that the job is done, this stops the animation.

Here is some sample code from Ray Wenderlich. The addOperationWithBlock call looks like taylored for you.

I prefer GCD more for C-API and try to avoid it with the Cocoa classes.


这篇关于另一种情况 - 加载演示文稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆