- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
int count = [entries count];
if (count == 0) {
return kCustomRowCount;
}
return count;
int rowCount;
if (self.isFiltered) {
rowCount = filteredTableData.count;
}
else {
rowCount = allTableData.count;
}
return rowCount;
}
My problem: The first function return count; is needed to fill the parsed data into the tableView. The second one return rowCount; is needed to count the filtered entries for the search. But when I use both, my App dies. When I delete the first part, the search seems to work incorrectly..
Sascha
It sounds like you need to be making use of the UISearchDisplayController. This controller essentially supports an unfiltered and a filtered (searched) list.
You can then use something like the following in your numberOfRowsInSection: