CollectionVIew size for item not sets for zero.It displays wrong size swift || sizeForItemAt return 0 but cell came || UICollectionView sizeForItemAt Called But Not Sized Correctly
Problem:
I had tried to set the size for item zero but it not sets properly.For that it returns sized value.
collection View(_: layout: size For Item At:)
let newSize = myArray.count > 0 ? CGSize(width: width/3, height: width/3) : CGSize(width: 0, height: 0)
return newSize
Solution:
Because in apple they already said that you must have to set the size value
to be non zero.
let newSize = myArray.count > 0 ? CGSize(width: width/3, height: width/3) : CGSize(width: 0.5, height: 0.5)
return newSize
Use the above code it will works good.
Comments
Post a Comment