UISearchController animations issues

Originator:matej
Number:rdar://21682685 Date Originated:06-Jul-2015 02:52 PM
Status:Open Resolved:
Product:iOS Product Version:iOS 9.0b2, iOS 8.4
Classification:UI/Usability Reproducible:Always
 
Summary:

While migrating PSPDFKit to the new UISearchController API, we noticed a few issues with implicit animations. 

On iOS 9b2:
- the search bar placeholder text doesn't animate from center alignment to left alignment the first time search is invoked (works fine afterwards though)
- the table view row deselection on the searchResultsController is abrupt instead of animated (as observable on a regular UITableViewController with clearsSelectionOnViewWillAppear enabled - the default configuration)

On iOS 8, the search bar placeholder animation works, the however the deselection does not occur at all.

Steps to Reproduce:

Extract the attached archive. The animations can be observed in the attached GIF (recorded on iOS 9).
The archive also contains a slightly modified version of the Apple TableSearch example. The only changes made were 1.) adding a launch storyboard for proper display on iPhone 6 and commenting a line that immediately deselected the selected cell (commented with a “//PSPDFKit” prefixed comment). 

Expected Results:

The placeholder text would always animate & the selected row deselection would be animated like usual for UITableViewController. 

Actual Results:

See Summary. 

Regression:

iOS 9.0b2, iOS 8.4, iPhone and iPad.

Comments

Example project

http://cl.ly/2I1N3C2d3I3d

Workaround for the deselection issue

  • (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated];

    // Only really needed on iOS 8, due to a UIKit bug, but also makes the deselection animation nicer on iOS 9 UITableView *searchTableView = ((UITableViewController )self.searchController.searchResultsController).tableView; NSIndexPath selectedIndexPath = searchTableView.indexPathForSelectedRow; if (selectedIndexPath != nil) { [searchTableView deselectRowAtIndexPath:selectedIndexPath animated:YES]; } }


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!