我在我的应用程序中使用UISearchBar。UISearchBar结果未显示
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
[self.filtered removeAllObjects];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.companyName contains[cd] %@",searchText];
NSArray *tempArray = [ee filteredArrayUsingPredicate:predicate];
filtered = [NSMutableArray arrayWithArray:tempArray];
}
我做NSLog
上面“过滤”阵列,它得到正确的搜索结果。
我没有看到tableview中的筛选值。如果我输入错误的搜索文字,我会看到“没有结果”。但是对于正确的搜索文本,表格视图是纯白色的。
谁能帮我需要做什么?
在此先感谢!
检查,看看你的数组为null – NightSkyCode
有你重装实现代码如下。被过滤的数组是tableview的数据吗? – Vinodh
我的过滤数组不是空,我做了NSLog来查看过滤的值。我在cellForRowAtIndexPath方法中以及在numberOfRowsInSection中看到过滤的数组值。 – user906492