zepojo / UPCarouselFlowLayout

A fancy carousel flow layout for UICollectionView on iOS.
MIT License
1.66k stars 236 forks source link

The behavior of the UICollectionViewFlowLayout is not defined because: #17

Open muratyilmaz opened 7 years ago

muratyilmaz commented 7 years ago

Hi, When i rotate device to landscape mode always taking this warning? Thanks.

The behavior of the UICollectionViewFlowLayout is not defined because: 2017-01-24 02:57:44.553 UPCarouselFlowLayoutDemo[32030:325685] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.

leojkwan commented 7 years ago

@muratyilmaz, Verified warning and getting the same issue in the demo project, any ideas to fixing this error?

muratyilmaz commented 7 years ago

@leojkwan This warning is annoying. Once you have to override "viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)" function in your ViewController class. Then, inside that function,you have to invalidate your layout in order to recreate and equalize zero sectionInset property of your layout.

Then, implement UICollectionViewDelegateFlowLayout collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize Inside above function, recalculate item size.

i'am sory. My english is not very well. i hope, you can understand :)

jerrypm commented 6 years ago

cek your Insets, maybe like this, u must be set to 0

self.colectionView1.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)

or this screen shot 2018-02-17 at 20 52 33

i hope help you