UISearchDisplayController UISearchBar(2)
NSLog(@"searchData count is%d",[self.searchData count]);
return [self.searchData count];
}
else{
NSDictionary *dic = [self.dataListobjectAtIndex:section];
NSArray *cityCount = [dicobjectForKey:@"Citys"];
int count = (int)[cityCount count];
for(int i = 0;i<count-1;i++){
NSDictionary *d = [cityCountobjectAtIndex:i];
NSString *Name = [dobjectForKey:@"C_Name"];
[self.allCitys addObject:Name];
}
return [cityCount count];
}
}
//分组的个数
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if([tableViewisEqual:self.searchController.searchResultsTableView])
return 1;
else
return [self.dataList count];
}
//每个分组的Header
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *HeaderName;
if([tableViewisEqual:self.searchController.searchResultsTableView]){
HeaderName = @"搜索结果";
}else{
NSDictionary *dict = [self.dataListobjectAtIndex:section];
HeaderName = [dictobjectForKey:@"p_Name"];
return HeaderName;
}
return HeaderName;
}
#pragma mark - UISearchDisplayControllerdelegate methods
-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
NSMutableArray *searchResult =[[NSMutableArray alloc] initWithCapacity:0];
int j =(int) [self.allCitys count];
for (int i = 0; i<j-1; i++) {
NSString *str = [self.allCitysobjectAtIndex:i];
相关新闻>>
- 发表评论
-
- 最新评论 更多>>