The title bar does not appear after the search. IOS8 + Xcode6

I have an app for iOS7 and below. I used UISearchDisplayController to search the table.

Problem:
After the title of the search header is not displayed in iOS8.
as shown in the images below.

Before searching: enter image description here

After the search: enter image description here


I tried using the UISearchController but also had the same problem I used this link code

I am adding the code below in TPSMastreViewController.m

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *v = [[UIView alloc] init]; v.backgroundColor = [UIColor greenColor]; return v; } 


I checked that the delegate is (UIView *) tableView: (UITableView *) tableView
viewForHeaderInSection: (NSInteger) section
not called in case of iOS8.
Edit:
I understand that only the delegate UITableViewDataSource is called, UITableViewDelegate did not.
Please, not that I set both delegates to ViewDidLoad
Question:
1] Is this a user interface change?
2] Any of them has a patch so that the delegate method is called forcefully.
+5
source share
1 answer

I found the answer, so I am writing here, it may help others facing the same problem

just need to add the delegate heightForHeaderInSection and display the header view for searchResultsController for UISearchController (iOS8) and searchResultsTableView for UISearchDisplayController (iOS7)

Add the code below to TPSMastreViewController.m and it will solve the problem.

 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 20; } 

I found my answer by reading this question :)
in iOS 8 UITableView heightForHeaderInSection is optional

+5
source

Source: https://habr.com/ru/post/974817/


All Articles