數組:
(
{id:1,data:(@"macbook",@"mac mini")},
{id:2,data:(@"ipad",@"ipod")},
{id:3,data:(@"macbook",@"ipod")}
)
predicate:
NSString *text = @"mac";
[NSPredicate predicateWithFormat:@"(data contains[cd] %@)",text];
[array filteredArrayUsingPredicate:predicate];
但是沒有再dictionary中實現循環數組。
不知道應該怎麼解決,請指教。
NSString* text = @"mac" ;
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"any data contains[cd] %@",text] ;
NSArray* filteredArray = [theArray filteredArrayUsingPredicate:predicate] ;