<分区>
<分区>
假设我有一个名为 aSet
的 NSIndexSet
,其编号范围为 26-89。
[aSet firstIndex]
给我 26
[aSet lastIndex]
给我 89
什么方法会给出第三个索引 (29)?
最佳答案
我不认为 NSIndexSet
可以用于那样的访问。您需要遍历它。例如-
int indexIwantToFind = 2;
int valueAtThisIndex = [aSet firstIndex];
for(int i = 0; i < indexIwantToFind; i++){
valueAtThisIndex = [aSet indexGreaterThanIndex:valueAtThisIndex];
}
NSLog(@"%d", valueAtThisIndex); //This will give you 39
关于objective-c - 查找 nsindexset 中的第 n 个条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13244001/
相关文章:
ios - 将传入消息附加到 ChatViewController collectionview (XMPPFramework+JSQMessagesViewController)
iphone - 如何在我们的 iPad 或 iPhone 应用程序中打开应用程序商店?
ios - Xcode 10 : Ambiguous Constraints Error When Adding Simple Constraints
objective-c - 如何在 Objective C 中安排方法调用
CGBitmapInfo 上的 Objective-C 到 Swift 转换问题
iphone - UISearchBar 中范围按钮文本的颜色
objective-c - 是否有用于 gSOAP 的 Objective-C 包装器?