0

On my Controller, I have a UICollectionView and I am loading data in 3 sections. These rows are showing price object. Each UICollectionViewCell contains class types like UILabel, TextField, and Checkbox. My requirement is if a user scrolls 1 row then all rows of the section should scroll at the same. For ex, there are 4 rows in section 0 and user scrolls 1st row then all 4 rows should scroll in the same direction.

If I have multiple UICollectionView in my class then I can handle the scroll using below code

self.priceCollectionView.contentOffset = scrollView.contentOffset

But here I have 1 UICollectionView so I tried below code

func scrollViewDidScroll(_ scrollView: UIScrollView) {
    let rowCount = self.priceCollectionView.numberOfItems(inSection: 0)
    for i in 0..<rowCount {
        let item = self.priceCollectionView.cellForItem(at: IndexPath(item: i, section: 0))

    }
}

Refer Image to see the cell data

These are the rows which I have to scroll simultaneously

I also followed below link

But there is no item.contentOffset property available. How should I solve this issue? Thanks in advance!!!

Angel F Syrus
  • 1,984
  • 8
  • 23
  • 43
Arti
  • 245
  • 1
  • 2
  • 13
  • your question are hard to understand. what do you mean by all row scroll it's default all row are scroll where is the issue. Put the video link what you are facing an issue so might other get the prob and provide some solution for – Nitin Gohel Jun 27 '19 at 07:35
  • As I have 4 rows in the section. I can horizontally scroll each row independently. But I want if user scrolls 1 row rest all should also scroll at the same time in same direction. – Arti Jun 27 '19 at 07:37
  • @Arti are you saying that if you have multiple sections in a `UICollectionView`, you want a horizontal scroll in one section to also horizontally scroll the other sections at the same time? – keno Jun 27 '19 at 07:44
  • I don't want to scroll sections simultaneously but rows. For ex, as in the image, there are 4 rows in section 0 and user scrolls row 0 then all 4 rows should scroll in the same direction. – Arti Jun 27 '19 at 08:18

0 Answers0