问题
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.
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?
回答1:
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.
来源:https://stackoverflow.com/questions/9948634/view-based-nstableview-vs-nscollectionview