List of views in Cocoa

What is the best GUI element that will work as a container for views? I will have the number of views (say 50), they are all the same, but I want to delete and add them at runtime. I am looking for something like a table, but with one column and a mutable number or rows.

+4
source share
2 answers

NSCollectionView or (with OS X 10.7) NSTableView are suitable classes for such a task. Just bind them to the NSArrayController.

While NSCollectionView requires all contained views to be the same size, NSTableView allows NSTableView to change the height.

Oh, and last but not least, of course, refers to the third-party PXListView class.

You can also check this answer for a related question: a custom list control in cocoa

+4
source

As Regexident said, NSCollectionView is Apple's way of doing what you mention.

Also check out the JUCollectionView :

enter image description here

JUCollectionView aims to reduce the delayed NSCollectionView. Instead of loading every possible cell at once, JUCollectionView only displays visible cells. To further improve performance, JUCollectionView also, if possible, reuses cells. This means that he must load a batch of cells to cover the view, and then reuse them all his life.

+3
source

All Articles