I have a UISplitViewController
with a UINavigationController
as the masterviewcontroller. This UINavigationController
has a UICollectionViewController
as its rootViewController. In the UICollectionViewController
, I have set the following parameters:
self.collectionView.scrollEnabled = YES;
self.collectionView.bounces = YES;
self.collectionView.alwaysBounceVertical = YES;
self.navigationController.navigationBar.prefersLargeTitles = YES;
UISearchController *sc = [[UISearchController alloc] initWithSearchResultsController:nil];
self.navigationItem.searchController = sc;
The UISearchBar
does show up in the navigationBar, but when I launch the app the navbar is collapsed to the small title. It's only when I drag the view downwards that the large title and the search bar appear.
Where I expect the view to launch like this
it actually launches like this
Any ideas what could be causing this?
Make sure you set preferLargeTitles
to true
in your UINavigationBar; either in code or in the Storyboard file.
Put this in your viewDidLoad.
self.navigationController?.navigationBar.prefersLargeTitles = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.