Dynamically modifying collection view cell size using size classes
As you saw earlier, the table view on the Journal List screen presents table view cells using rows arranged in a single column. This works great on an iPhone, but as you have seen, this results in a lot of wasted space if you run the app on an iPad. Even though you can use the same UI for both iPhone and iPad, it would be better if you could customize it to suit each device.
To do this, you’ll add some code so your app can identify the size of the screen it’s running on, and you’ll dynamically modify the size of the collection view cells in the collection view to suit. You can identify the current screen size using size classes; you’ll learn about them in the next section.
Understanding size classes
To determine the size of the screen your app is running on, you must consider the effects of device orientation on your UI. It can be challenging to do this as there is a wide variety...