0
我在我的UITableViewController中有一個UISearchController。我希望隱藏搜索欄,直到用戶向下滾動。在舊UISearchDisplayController,我在我的viewDidLoad方法如下代碼:UISearchController隱藏搜索欄
//Hides the search bar until user manually scrolls up.
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
CGRect newBounds = self.tableView.bounds;
newBounds.origin.y = newBounds.origin.y + self.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
不幸的是,上面的代碼不再與UISearchController工作。