navigationItem.searchController行为与ios12不同

时间:2019-07-01 16:06:37

标签: ios uikit uisearchcontroller uinavigationitem ios13

在iOS12中,navigationItem.searchController应该在按下时显示,在按下时隐藏。 ios13中的错误,它可以显示但不能隐藏,除非您的列表比屏幕长,以下是我的代码,在ios12中可以正常工作:

_searchController.searchResultsUpdater = self;
_searchController.obscuresBackgroundDuringPresentation = NO;
_searchController.searchBar.placeholder = SP_LOCSTR(@"Search");
_searchController.searchBar.tintColor = [UIColor whiteColor];
_searchController.dimsBackgroundDuringPresentation = NO;
_searchController.hidesNavigationBarDuringPresentation = YES;
_searchController.delegate = self;
self.navigationItem.searchController = _searchController;
self.navigationItem.hidesSearchBarWhenScrolling = YES;

0 个答案:

没有答案