开发者

iPhone SDK Noob Problem with Search Bar

I hope you will reply to this:

I once had this kind of array:

NSArray *array = [NSArray arrayWithObjects:@"Object1", @"Object2", @"Object3", nil];
NSDictionary *arrayDictionaryDict = [NSDictionary dictionaryWithObject:array forKey:@"Key"];

[listOfItems addObject:arrayDictionaryDict];

Now I have this:

NSDictionary *dict1 = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Object1", @"Subtitle1", @"Object2", @"Subtitle2", @"Object3", @"Subtitle3", nil] fo开发者_高级运维rKeys:[NSArray arrayWithObjects:@"title", @"subtitle", @"title", @"subtitle", @"title", @"subtitle", nil]];

listOfItems = [[NSArray alloc] initWithObjects:dictA, nil];

I also had a search bar with this method:

// in search the table view void
[…]
for (NSDictionary *dictionary in listOfItems) {

     NSArray *array = [dictionary objectForKey:@"Key"];
 [searchArray addObjectsFromArray:array];

}

[B]How should I change this last method to fit the new Array and search both in the title and subtitle?[/B]

Thanx


NSArray *array = [dictionary allValues];

This returns an NSArray with all saved values. If I understand your question correctly, this is what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜