How to calculate iOS 11 size in different orientation?

前端 未结 2 1463
梦毁少年i
梦毁少年i 2021-02-13 09:20

I calculate itemSize dependent on safe area for UICollectionView with horizontal scroll and custom layout.

\"image\"

2条回答
  •  青春惊慌失措
    2021-02-13 09:40

    Use UICollectionViewDelegateFlowLayout's collectionView(_:layout:sizeForItemAt:). Works like a charm. Setting the size in the completion block of coordinator.animate(alongsideTransition:completion:) in viewWillTransition(to:with:) didn't work for me because the size animation occurs after the orientation animation ends, which looks weird.

提交回复
热议问题