我有一个搜索栏图标,在按下时调用它:
SearchTableViewController *searchView = [[SearchTableViewController alloc]initWithNibName:@"SearchTableViewController" bundle:nil];
UINavigationController *navCtlr = [[UINavigationController alloc]initWithRootViewController:searchView];
UISearchController *searchController = [[UISearchController alloc]initWithSearchResultsController:navCtlr];
[searchController setDefinesPresentationContext:YES];
searchController.delegate = searchView;
searchController.searchResultsUpdater = searchView;
searchView.searchController = searchController;
searchController.searchBar.keyboardAppearance = UIKeyboardAppearanceDark;
[self presentViewController:searchController animated:YES completion:nil];
在我的SearchTableViewController.m文件中,我有一个成功调用的push segue:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
DetailTableViewController *seeAll = (DetailTableViewController *) [storyboard instantiateViewControllerWithIdentifier:@"DetailTableViewController"];
seeAll.query = self.searchController.searchBar.text;
seeAll.title = @"Songs";
[self.navigationController pushViewController:seeAll animated:YES];
然而,我没有得到预期的行为,即。
预计基于Apple Music的UISearchController: 推前:
发生在我身上的事情: