Working with UISearchDisplayController I found the following issue as show in image uploaded at this URL.
Default height of the row is 74, but when the results are zero, I don’t whats happening but multiple separator lines appear.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 74;
}
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self performSelectorInBackground:@selector(loadMySearchObjectsInBackground) withObject:nil];
return NO;
}
- (void) loadMySearchObjectsInBackground{
NSString *searchStr=self.searchDisplayController.searchBar.text;
NSArray *foundItems;
.....Code to fetch Result from Server.......
[self.searchDisplayController.searchResultsTableView reloadData];
}
The above code works fine when results>0. But causes problem when foundItems count=0.
Any idea’s to solve this.
Set separatorSyteNone both in numberOfRowsInSection and cellForRowAtIndexPath