I am currently using UICollectionView
for the user interface grid, and it works fine. However, I\'d like to be enable horizontal scrolling. The grid supports 8
Another way of doing this is setting the collectionView.center.x
, like so:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if let
collectionView = collectionView,
layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout
{
collectionView.center.x = view.center.x + layout.sectionInset.right / 2.0
}
}
In this case, only respecting the right inset which works for me.