UPCarouselFlowLayout icon indicating copy to clipboard operation
UPCarouselFlowLayout copied to clipboard

connect carousel with pageView

Open Melf11 opened this issue 7 years ago • 2 comments

hi, first of all, thanks for your work! the carousel is working nice for my app.

i want to connect the carousel with my pageView. My carousel just got a label with headings in it and when i swipe left or right i can change between different pageViews. Now i want to connect the heading-labels with my pages, like the pageViewController

so i want to swipe the headings "audio","netzwerk","player" together with the pageView it looks like this

pageviewcontroller kopie

Melf11 avatar Jul 11 '17 10:07 Melf11

hi, sorry, i solved my problem with https://github.com/PageMenu/PageMenu that is exaclty what i was searching for. but thanks anyway for your programm!

Melf11 avatar Jul 13 '17 10:07 Melf11

I know it has been asked a long time ago, but if anyone face this problem too, I solved it by getting the indexPath of the center UICollectionViewCell.

func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let center = CGPoint(x: scrollView.contentOffset.x + (scrollView.frame.width / 2), y: (scrollView.frame.height / 2))
        if let ip = self.collectionView!.indexPathForItem(at: center) {
            self.pageControl.currentPage = ip.row
        }
}

Bertges avatar Jan 05 '18 15:01 Bertges