我刚刚实现了一个 NSCollectionView,就像 developer page 中描述的那样而且效果很好。
现在,如何从 CollectionView 访问 collectionViewItems?
最佳答案
如果您真的需要枚举 Collection View 中的所有项目,那么:
NSUInteger numberOfItems = [[collectionView content] count];
for (NSUInteger itemIndex = 0; itemIndex < numberOfItems; itemIndex++) {
NSCollectionViewItem *item = [collectionView itemAtIndex:itemIndex];
// do something with item
}
应该可以在 Mac OS X v10.6+ 上完成。
关于objective-c - 如何从 NSCollectionView 中检索 NSCollectionViewItems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6508488/