gpt4 book ai didi

ios - 正在运行解析 getDataInBackgroundWithBlock :progressBlock: the same as creating a new thread using GCD?

转载 作者:行者123 更新时间:2023-11-29 03:14:54 25 4
gpt4 key购买 nike

我正在努力提高我的 UICollectionView 加载时间的性能。我正在使用 Parse 来存储我的所有数据,我的问题是我是否应该考虑将 GCD 与 Parse 结合使用?

目前,我正在使用以下方式加载所有图像:

getDataInBackgroundWithBlock:progressBlock:

但是,我想知道我是否应该使用:

dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
// Perform long running process

dispatch_async(dispatch_get_main_queue(), ^{
// Update the UI

});
});

你对此有何看法?

最佳答案

解析方法已经在后台线程上运行。您需要注意的是您在完成 block 中所做的事情。

如果您在那里做任何重要的事情,并且这会导致您的 UI 滞后,您可以在完成 block 中使用另一个线程来执行额外的处理并反馈给 UI。

如果您只是担心加载时间,请查看本地缓存选项。 Parse 有 check the local cache first 的选项.

关于ios - 正在运行解析 getDataInBackgroundWithBlock :progressBlock: the same as creating a new thread using GCD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21803965/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com