Incorrect UITableView section header placement with UISearchDisplayController

Originator:brianpartridge
Number:rdar://14676046 Date Originated:8/7/2013
Status:Open Resolved:
Product:iPhone Product Version:6.1
Classification: Reproducible:Always
 
Summary:
When using a UITableView with a UISearchDisplayController, it is possible to cause a bug where the main UITableView's section header views appear 'above' the UISearchDisplayController's search results table view. 

Steps to Reproduce:
A demo project is attached and screenshots (1-5.png) are included to illustrate.
1. See the main table list, it has a section header.
2. Tap the search bar.
3. Type in the search bar and the search results table appears, it has no header.
4. Tap a search result and a new view controller is pushed on the stack.
5. Tap back and you will see the section header that was on the main table list 'above' the search result items.

Expected Results:

The main table view's headers should stay below the search results table view.  The main table view should be smart enough to know when it has a child view (the search results table view) and layout the section headers 'below' it.

Actual Results:

The main table view's headers hover 'above' the search results table view.

Regression:

Not sure if this is a regression.  I've seen it on iOS 6.1 and on iOS 7 beta 5.

Notes:

The trigger for this issue appears to be a call to [self.tableView reloadData] in viewWillAppear:.  When this method is not called there is no issue.  The problem is that some times you need to call reloadData before the view did appear so that it is updated and ready for when the user dismisses search mode.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!