UICollectionView Layout Issue

前端 未结 15 1784
天涯浪人
天涯浪人 2020-12-24 00:17

I am using UICollectionView using the flow layout. I have made a custom UICollectionViewCell for the same. But on running the project the console k

15条回答
  •  没有蜡笔的小新
    2020-12-24 01:13

    If you are using storyboards and auto layout, debugging this kind of problems is really hard...

    I had similar problem when trying to display UICollectionViewCell fullscreen on iPhone.

    Most of the time issue is with the size of the cell set in

    -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)
    

    or directly on flowLayout.itemSize.

    But... try:

    1. Select the ViewController:

    Selecting View Controller

    1. Then uncheck Extend Edges options:

    Disable Extend Edges Options

    And now try setting your auto layout constraints.

    Good luck.

提交回复
热议问题