我希望你能回复:
我曾经有过这种阵列:
NSArray *array = [NSArray arrayWithObjects:@"Object1", @"Object2", @"Object3", nil];
NSDictionary *arrayDictionaryDict = [NSDictionary dictionaryWithObject:array forKey:@"Key"];
[listOfItems addObject:arrayDictionaryDict];
现在我有了这个:
NSDictionary *dict1 = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Object1", @"Subtitle1", @"Object2", @"Subtitle2", @"Object3", @"Subtitle3", nil] forKeys:[NSArray arrayWithObjects:@"title", @"subtitle", @"title", @"subtitle", @"title", @"subtitle", nil]];
listOfItems = [[NSArray alloc] initWithObjects:dictA, nil];
我还有一个使用此方法的搜索栏:
// in search the table view void
[…]
for (NSDictionary *dictionary in listOfItems) {
NSArray *array = [dictionary objectForKey:@"Key"];
[searchArray addObjectsFromArray:array];
}
[B]我应该如何更改最后一个方法以适应新数组并在标题和副标题中搜索?[/ B]
感谢名单
答案 0 :(得分:0)
NSArray *array = [dictionary allValues];
这将返回包含所有已保存值的NSArray。如果我理解你的问题,这就是你要找的。 p>