Slide view together with UICollectionView cell

i have this structure. Scrollview -> UICollectionview + Label

This viewcontroller has array of items (BlockItem). On scrollViewDidScroll i change current test label

func scrollViewDidScroll(_ scrollView:UIScrollView)
    let midX:CGFloat = scrollView.bounds.midX
    let midY:CGFloat = scrollView.bounds.midY
    let point:CGPoint = CGPoint(x:midX, y:midY)

        let indexPath:IndexPath = collectionView.indexPathForItem(at:point)


    let currentPage:Int = indexPath.item
    if let found = items.first(where: {$ == String(block[currentPage])}) {
        description.text = found.description


The main issue that i want my description label will be moving together when i move my collectionview cell and appear from the next cell. In other words, if I scroll to the left my description should move along with the cell, i.e. go to the left and appear on the right of the screen.

How can i do this? I know i could make a big collectionviewcell but i need that only image part should be scrollable, not the entire block.

Here is what i want to achieve

This seems more like a UIKit issue, rather than a Swift usage problem. May I suggest somewhere like StockOverFlow to pose your question to? :)

1 Like
Terms of Service

Privacy Policy

Cookie Policy