I have working application for iOS7 and below
I used UISearchDisplayController for search in table.
Problem :
After search header view is not display in iOS8.
as display in below images.
Before search :
After search :
I add below code in TPSMastreViewController.m
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *v = [[UIView alloc] init];
v.backgroundColor = [UIColor greenColor];
return v;
}
I found answer so writing here it may help others facing same problem
just need to add delegate heightForHeaderInSection and it will show header view for both searchResultsController for UISearchController(iOS8) and searchResultsTableView for UISearchDisplayController(iOS7)
Add below code in TPSMastreViewController.m and it will solve problem.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20;
}
I found my answer by reading this question :)
in iOS 8 UITableView heightForHeaderInSection is not optional
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With