ios - 如何快速打开 View Controller 而不执行其进程?

标签 ios swift uiviewcontroller

我必须显示包含大量图像和视频的各种文件夹,但是当我单击该文件夹时,需要几秒钟才能加载,这看起来像是滞后或挂起......

我想先打开 View Controller ,然后显示加载过程...... 怎么做 ???

最佳答案

你可以像这样在后台加载数据

DispatchQueue.global(qos: .background).async {
   // load data here
}

之后需要在主线程中加载UI

DispatchQueue.main.sync {
            // show data here
        }

关于ios - 如何快速打开 View Controller 而不执行其进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59104868/

相关文章:

ios - Swift - fatal error : unexpectedly found nil while unwrapping an Optional values

ios - 如何在自定义容器 View Controller 中实现交互式转换

ios - 使用跟随手指 ios 显示两个隐藏 View

ios - 从路径获取文件内容

ios - Swift:如何将单元格 View 设计为两个三角形?

objective-c - 将通知推送到应用组 iOS

ios - 根据 UICollectionView 中 url 的 json 响应从应用程序内添加图像

ios - UIImagePNGRepresentation() 旋转我的 UIImage

ios - UIViewController 生命周期调用结合状态恢复

ios - 子容器 View 中的 UILabel 未更新