Search code examples
iosuicollectionviewswift3uipageviewcontrolleruicollectionviewlayout

UIPageViewController along with UICollectionView for cell grid structure


I have a UICollectionView, which uses UICollectionViewFlowLayout to arrange my cells inside the collection view.

Inside my cells, I have an image and a label. Using the above layout I am able to design my collection view with vertical scrolling,

But instead of vertical scrolling, I want a structure like UIPageViewController which will contain my UICollectionView with the above cells.

I have tried with flowLayout.scrollDirection = .horizontal, But with that approach I could not solve my issue.

I am new to Swift and I am not using storyboards.


Solution

  • I found my answer from the below link: http://swiftiostutorials.com/ios-tutorial-using-uipageviewcontroller-create-content-slider-objective-cswift/

    It really helped me a lot. Thanks.