基于视图的NSTableView和NSCollectionView? [英] View-based NSTableView vs NSCollectionView?

查看:176
本文介绍了基于视图的NSTableView和NSCollectionView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经了解了基于单元格的NSTableView的飞行方法,我想我理解与NSCollectionView的差异。 (基于单元格的)NSTableView和NSCollectionView之间的差异

I've understood the fly-weight approach of cell-based NSTableView and I think I understand the differences with NSCollectionView.Differences between (cell-based) NSTableView and NSCollectionView

但是,稍微不太明显的是

However, a bit less obvious is the differences between view-based NSTableView and NSCollectionView.

使用NSCollectionView在显示其项目(即在网格布局中)时的灵活性,可以模拟一个tableView的列表(一个最多一列的网格,并且不包括个人首选项,为什么有人选择(基于视图)NSTableView通过NSCollectionView?

With NSCollectionView's flexibility in displaying its items (i.e. in a grid layout) which could emulate a tableView's list (a grid with maximum one column) and excluding personnal preferences, why would someone choose (View-based) NSTableView over NSCollectionView?

推荐答案

NSCollectionView 不使用视图回收。这意味着将为每个收集视图项目创建一个视图,而不管视图是否在屏幕上。这可能会破坏您的大数据集的性能。基于视图的 NSTableView 使用视图循环,并且非常高效,因为它循环使用有限数量的单元格,而不是为每个项目创建新的单元格。更不用说 NSCollectionView 是一个写得不好,文档不太好的类。

NSCollectionView doesn't use view recycling. This means that a view will be created for every single collection view item, regardless of whether the view is on screen or not. This can wreck your performance with large data sets. A view based NSTableView uses view recycling and is very efficient, as it recycles a limited number of cells instead of creating new ones for every item. Not to mention that NSCollectionView is overall a poorly written and poorly documented class.

这篇关于基于视图的NSTableView和NSCollectionView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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