【发布时间】:2015-09-13 16:58:25
【问题描述】:
我在 Objective-C 中看到了一些示例,例如 this one,但 NSCollectionView.subview 使用了一个名为 .indexOfObject 的属性,我假设它已被 .indexOf 替换,但我不确定如何使用使用.indexOf。
Objective-C 中的上下文
NSInteger index = [[myCollectionView subviews] indexOfObject:self];
斯威夫特版本
var index = collectionView.subviews.indexOf(element: Self.Generator.Element)
问题:
如何使用indexOf 获取选定NSCollectionView 的索引?
【问题讨论】:
标签: macos swift indexing xcode7 nscollectionview