UISplitViewController - Sidebar large titles with UICollectionView? (iOS14)

I'm learning about setting up a new UISplitViewController in iOS/iPadOS 14. I have primary, supplementary, and secondary view controllers configured on the splitViewController using setViewController(for:) method. I'm using the primary view controller as a Sidebar, and have prefersLargeTitles set to true on it.

It seems like when I set up a UICollectionView in the Sidebar view controller, it causes the large title to go away. Configuring the collection view via frame (collectionView.frame = view.bounds), or via programmatic constraints doesn't seem to matter - the large title goes away either way.

Is this a bug, or is there something I'm doing wrong? Thanks!
Answered by Frameworks Engineer in 616500022
It's not completely clear what is happening when you say "it causes the large title to go away", but perhaps what is happening is that your collection view doesn't have a lot of content inside it, and therefore doesn't need to be scrollable vertically (in other words, its contentSize.height is less than its bounds.size.height). To ensure that the collection view is always vertically scrollable, set the property alwaysBounceVertical on it to true, which will ensure the navigation bar and large title can always expand and collapse. In future iOS 14 seeds, the alwaysBounceVertical and alwaysBounceHorizontal properties will be set automatically by default when using a compositional layout (including list layouts) with your collection view, but in seed 1 you need to set this manually.
Accepted Answer
It's not completely clear what is happening when you say "it causes the large title to go away", but perhaps what is happening is that your collection view doesn't have a lot of content inside it, and therefore doesn't need to be scrollable vertically (in other words, its contentSize.height is less than its bounds.size.height). To ensure that the collection view is always vertically scrollable, set the property alwaysBounceVertical on it to true, which will ensure the navigation bar and large title can always expand and collapse. In future iOS 14 seeds, the alwaysBounceVertical and alwaysBounceHorizontal properties will be set automatically by default when using a compositional layout (including list layouts) with your collection view, but in seed 1 you need to set this manually.
Slightly similar situation to the OP's question; alwaysBounceVertical was the right toggle in my case! Thanks @Frameworks Engineer.
@FrameworksEngineer This fixed it! Thank you!
UISplitViewController - Sidebar large titles with UICollectionView? (iOS14)
 
 
Q