Giu*_*ppe 4 cocoa objective-c cocoa-bindings
我刚刚实现了一个NSCollectionView,就像在开发者页面上描述的那样,它可以很好地工作.
现在,我如何从CollectionView访问collectionViewItems?
小智 6
如果您确实需要枚举集合视图中的所有项目,那么:
NSUInteger numberOfItems = [[collectionView content] count];
for (NSUInteger itemIndex = 0; itemIndex < numberOfItems; itemIndex++) {
NSCollectionViewItem *item = [collectionView itemAtIndex:itemIndex];
// do something with item
}
Run Code Online (Sandbox Code Playgroud)
应该在Mac OS X v10.6 +上做到这一点.