I'm using the new double column UISplitViewController and a UICollectionView with the new .sidebar appearance as the primary view controller.
To understand how this new API works, I created a sample project and hosted it on Github, so you can download and run it to reproduce the problem I'm facing. It was based on the sample code from Implementing Modern Collection Views, specifically, on the OutlineViewController class of the project.
Everything is working fine, the primary and secondary views are shown and I can switch between the views on the sidebar by tapping on them. The problem happens when I open a second app with Split View and adjust the size of the second app by dragging the app divider, so my app stays on the Regular mode, and the second app on Compact mode.
This somehow breaks the layout of the sidebar (and no errors are printed out to the console). Here's a screenshot that shows what happens.
If I restart the app, turn the iPad to portrait mode (which changes the layout to Compact), and then turn it to landscape (which changes the layout back to Regular), this is what happens to the sidebar. And also, the following auto layout error is printed on the console:
I noticed that if I do not specify a .flexibleWidth for the autoresizingMask of the collection view, this problem stops. But then the style of the selected items on the sidebar no longer works as expected, as we can see on this screenshot.
So, is this a bug with the new .sidebar appearance of the collection view, or did I do something wrong when configuring my views?
To understand how this new API works, I created a sample project and hosted it on Github, so you can download and run it to reproduce the problem I'm facing. It was based on the sample code from Implementing Modern Collection Views, specifically, on the OutlineViewController class of the project.
Everything is working fine, the primary and secondary views are shown and I can switch between the views on the sidebar by tapping on them. The problem happens when I open a second app with Split View and adjust the size of the second app by dragging the app divider, so my app stays on the Regular mode, and the second app on Compact mode.
This somehow breaks the layout of the sidebar (and no errors are printed out to the console). Here's a screenshot that shows what happens.
If I restart the app, turn the iPad to portrait mode (which changes the layout to Compact), and then turn it to landscape (which changes the layout back to Regular), this is what happens to the sidebar. And also, the following auto layout error is printed on the console:
I noticed that if I do not specify a .flexibleWidth for the autoresizingMask of the collection view, this problem stops. But then the style of the selected items on the sidebar no longer works as expected, as we can see on this screenshot.
So, is this a bug with the new .sidebar appearance of the collection view, or did I do something wrong when configuring my views?