Ios UISearchBar在导航栏下方的动画设置不正确

Ios UISearchBar在导航栏下方的动画设置不正确,ios,objective-c,uitableview,uisearchcontroller,Ios,Objective C,Uitableview,Uisearchcontroller,我有两个视图控制器,每个都包含UISearchController和UITableView。viewDidLoad中的代码是: SearchResultsTableViewController *searchResultController = [[SearchResultsTableViewController alloc]initWithNibName:@"SearchResultsTableViewController" bundle:nil]; UINavigationControlle

我有两个视图控制器,每个都包含
UISearchController
UITableView
viewDidLoad中的代码是:

SearchResultsTableViewController *searchResultController = [[SearchResultsTableViewController alloc]initWithNibName:@"SearchResultsTableViewController" bundle:nil];
UINavigationController *navSearchResultsController = [[UINavigationController alloc] initWithRootViewController:searchResultController];

self.searchController = [[UISearchController alloc] initWithSearchResultsController:navSearchResultsController];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = YES;
[self.searchController.searchBar sizeToFit];
self.searchController.searchBar.delegate = self;
self.searchController.delegate = self;

self.tableView.tableHeaderView = self.searchController.searchBar;
self.tableView.userInteractionEnabled = YES;
第一个视图控制器是
rootViewController
,它工作完美,没有任何问题。第二个视图控制器通过基于段选择的导航控制器推送

[self.navigationController pushViewController:self.vc];
第二个视图控制器只有一个问题。当我点击
搜索栏
时,它会动画显示在顶部,并进入导航栏下方,而第一个在其位置上动画显示,并且不会上升

谁能告诉我如何禁用此动画? 我想在搜索时将
搜索栏
保持在原来的位置。这两个视图控制器的实现完全相同。为什么每个人的行为都不同

谢谢,

将设置为
NO

self.searchController.hidesNavigationBarDuringPresentation = NO;
或者尝试一下,听起来和你想做的事情很相似。但您可能需要调整这一行:

[super setActive: visible animated: animated]; // instead of passing animated, pass NO

我不理解这一点
第二个视图控制器是通过基于段选择的导航控制器推送的。
我的意思是有一个分段控制器。当我点击第二段时,它会导航到第二个viewController。我试图设置hidesNavigationBarDuringPresentation,但它也不起作用。UISearchController不具有setActive方法的动画参数。