我是一名有用的助手,可以为您进行文本翻译。以下是需要翻译的内容:
我想在这里只隐藏搜索栏,并显示一个带有标题的普通导航栏:
当屏幕首次显示时,我的导航栏中没有搜索栏。我通过触发并显示导航栏中的搜索栏,但现在想知道如何隐藏搜索栏并再次显示导航栏标题。
我创建搜索栏如下:
_searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.placeholder = nil;
[self.searchController.searchBar sizeToFit];
//self.tableView.tableHeaderView = self.searchController.searchBar;
self.sharedNavigationItem.titleView = _searchController.searchBar;
self.searchController.delegate = self;
self.searchController.dimsBackgroundDuringPresentation = NO; // default is YES
self.searchController.searchBar.delegate = self; // so we can monitor text changes + others
self.definesPresentationContext = YES;
_searchController.hidesNavigationBarDuringPresentation = NO;
我想在这里只隐藏搜索栏,并显示一个带有标题的普通导航栏: