【发布时间】:2013-09-07 19:27:45
【问题描述】:
当前尝试设置搜索将搜索如下所示的数组 (bakeryProductArray)
“茶饼”, 提拉穆苏, “糖浆面包”, 琐事, “三重巧克力布朗尼”, 松露, “各种海绵”, “维也纳漩涡”, “婚礼蛋糕”
用户在 UISearchbar 中键入的内容。我不清楚如何在 CFString 中表示数组中的每个项目。
我目前拥有的代码是。
-(void)filterContentForSearchText:(NSString *)searchText scope:(NSString *)scope
{
searchSearch = [NSPredicate predicateWithFormat:@"self CONTAINS[cd]",searchText];
//@"%K CONTAINS[cd] %@"
searchResults = [bakeryProductArray filteredArrayUsingPredicate:searchSearch];
NSLog(@"Filtered Food Product Count --> %d",[searchResults count]);
}
可以回答任何问题并在需要时提供更多代码。
【问题讨论】:
标签: ios objective-c nsarray nspredicate