Sma*_*ree 7 iphone xcode objective-c nsarray ios
我有一个array充满了NSDictionaries.我想找到index一本字典,但我对这本字典的了解只是一个value关键@"name".
我怎么做?
Mar*_*n R 37
查找第一库的指标theArray,其值@"name"是theValue:
NSUInteger index = [theArray indexOfObjectPassingTest:
^BOOL(NSDictionary *dict, NSUInteger idx, BOOL *stop)
{
return [[dict objectForKey:@"name"] isEqual:theValue];
}
];
Run Code Online (Sandbox Code Playgroud)
index会NSNotFound如果没有匹配的对象被发现.
| 归档时间: |
|
| 查看次数: |
5589 次 |
| 最近记录: |