3ph / CollectionPickerView

A generic customizable picker view based on UICollectionView.
MIT License
31 stars 10 forks source link

pickerView.cellSpacing does nothing #4

Closed SubZane closed 5 years ago

SubZane commented 5 years ago

In the example (and my own implementation), changing pickerView.cellSpacing = 10 to pickerView.cellSpacing = 100

doesn't make any difference. The cells are still zero pixels between each other

SubZane commented 5 years ago

If I edit CollectionPickerView.swift and swap the cellSpacing variable, clean build folder and run I get spacing between cells.

    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
        return 0
    }

    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
        return cellSpacing
    }

As I understand it, minimumInteritemSpacingForSectionAt SHOULD affect spacing between cells, however in this project minimumLineSpacingForSectionAt is the one that adds spacing between cells?

I'm fairly new to Swift, but it could be a possible solution?

3ph commented 5 years ago

Yeah, you are right. I've added a little fix seems to be working now. I'll test it some more and then make a new release.

SubZane commented 5 years ago

great! and I just found another bug....sorry :P