ios - 在哪些队列中执行 Collection View 的委托(delegate)/数据源方法?

标签 ios swift uicollectionview queue

我一直假设所有 collectionView/tableView 委托(delegate)/数据源方法都在主队列中执行,只是想验证一下。

最佳答案

任何框架提供的与 UI 相关的东西都在主线程中执行并验证 do

print(Thread.isMainThread)

在任何这些协议(protocol)方法中,你也可以打印

print(Thread.main)
print(Thread.current)

如果匹配则为主线程,否则为另一个线程

关于ios - 在哪些队列中执行 Collection View 的委托(delegate)/数据源方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52958894/

相关文章:

ios - Collection View 仅显示数组中的一项

ios - 注册大量 UICollectionViewCell 类以在 UICollectionView 中重用

ios - 字符串中指定的颜色变化。 swift iOS

ios - 使用 StoryBoard 添加 TableFooter View

ios - UITabBarController 与 UIViewControllers 和 UITableViewControllers

iphone - 在 iOS 应用程序包文件中进行全文搜索

swift - 已调用 textFieldShouldBeginEditing,未调用 textFieldDidBeginEditing

xcode - swift:更新解析对象而不知道他的objectId

ios - 如果滚动,UICollectionView 应用程序会崩溃

ios - 删除核心数据元素