Why does UICollectionView log an error when the cells are fullscreen?

后端 未结 10 1318
悲&欢浪女
悲&欢浪女 2020-12-08 04:06

I have a UICollectionViewController using a UICollectionViewFlowLayout where my itemSize is the size of the UICollectionView

10条回答
  •  自闭症患者
    2020-12-08 04:46

    This issue just occured to me on 3x screens (namely the iPhone 6 Plus.) As it turned out, the autolayout engine did not really like infinite floating point values (such as .33333333), so my solution was to floor the return height in sizeForItemAt:indexPath:.

    return CGSize(width: preferredWidth, height: floor(preferredHeight))
    

提交回复
热议问题