All Projects β†’ yudiz-solutions β†’ SJCenterFlowLayout

yudiz-solutions / SJCenterFlowLayout

Licence: other
Carousel flow layout for UICollectionView on iOS.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to SJCenterFlowLayout

Bouncylayout
Make. It. Bounce.
Stars: ✭ 4,035 (+11767.65%)
Mutual labels:  layout, uicollectionviewlayout, flowlayout
Centeredcollectionview
A lightweight UICollectionViewLayout that 'pages' and centers its cells 🎑 written in Swift
Stars: ✭ 965 (+2738.24%)
Mutual labels:  carousel, uicollectionviewlayout
Uicollectionview Layouts Kit
πŸ“ A set of custom layouts for UICollectionView with examples [Swift 5.3, iOS 12].
Stars: ✭ 410 (+1105.88%)
Mutual labels:  layout, uicollectionviewlayout
Hjcarouseldemo
Stars: ✭ 437 (+1185.29%)
Mutual labels:  carousel, uicollectionviewlayout
Why-Not-Image-Carousel
Why Not use Image Carousel if you have lots of images to show!
Stars: ✭ 310 (+811.76%)
Mutual labels:  carousel, carousel-view
Blueprints
πŸŒ€ Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Stars: ✭ 874 (+2470.59%)
Mutual labels:  layout, uicollectionviewlayout
Collectionviewpaginglayout
a simple but highly customizable paging layout for UICollectionView.
Stars: ✭ 947 (+2685.29%)
Mutual labels:  layout, uicollectionviewlayout
CSStickyFlowLayoutHeaders
UICollectionView replacement for your amazing headers
Stars: ✭ 16 (-52.94%)
Mutual labels:  uicollectionviewlayout, flowlayout
react-gallery-carousel
Mobile-friendly gallery carousel 🎠 with server side rendering, lazy loading, fullscreen, thumbnails, touch, mouse emulation, RTL, keyboard navigation and customisations.
Stars: ✭ 178 (+423.53%)
Mutual labels:  carousel
react-native-animated-carousel
πŸ¦„ A wonderful animated carsouel hooks component for React-Native
Stars: ✭ 16 (-52.94%)
Mutual labels:  carousel
Transfiguration
Mystical way to transform data into reusable view in Swift
Stars: ✭ 14 (-58.82%)
Mutual labels:  uicollectionviewlayout
nglp-angular-material-landing-page
NGLP is an Angular Material Landing Page.
Stars: ✭ 32 (-5.88%)
Mutual labels:  carousel
StickerLayout
sticker layout,ε›Ύη‰‡ηΌ©ζ”Ύζ‹–εŠ¨γ€‚εœ¨ε›Ύη‰‡δΈŠζ‰“ε›Ύζ ‡ε’Œζ–‡ε­—ζ ‡η­Ύ
Stars: ✭ 15 (-55.88%)
Mutual labels:  flowlayout
diorama
An image layout algorithm
Stars: ✭ 17 (-50%)
Mutual labels:  layout
vue-smart-widget
πŸ—ƒοΈSmart widget is a flexible and extensible content container component for Vue2.x / Vue3.x in Next branch.
Stars: ✭ 110 (+223.53%)
Mutual labels:  layout
TableViewKit
Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations
Stars: ✭ 105 (+208.82%)
Mutual labels:  layout
css-pro-layout
CSS library for building responsive and customizable layouts
Stars: ✭ 53 (+55.88%)
Mutual labels:  layout
EZAnchor
An easier and faster way to code Autolayout
Stars: ✭ 25 (-26.47%)
Mutual labels:  layout
ErrorLayout
Simple layout to show custom error toast with animation
Stars: ✭ 13 (-61.76%)
Mutual labels:  layout
css-layout
ζ—¨εœ¨θ‚–ι™€ζ··δΉ±ηš„CSS布局教程
Stars: ✭ 18 (-47.06%)
Mutual labels:  layout

Preview

Demo

Features

  • Animate cell scale while scrolling
  • Rotate cell while scrolling
  • Easy to integrate and use
  • Easy Customizeable

Requirements

  • iOS 11.0 +

Usage

Via code

Create a SJCenterFlowLayout object, set its itemSize and assign it to your UICollectionView.

let layout = SJCenterFlowLayout()
layout.itemSize = CGSizeMake(200, 200)
collectionView.collectionViewLayout = layout

via Interface Builder

Set the UICollectionView layout class to SJCenterFlowLayout, and set its itemSize and its properties as given below

Alt text

Properties

  • animationMode (default is scale with sideItemScale between 0 and 1, default is 0.7, sideItemAlpha: between 0 and 1, default is 0.6, sideItemShift: value in pixels, default is 0)

Can be set only through code.

  • SJCenterFlowLayoutAnimation.scale(sideItemScale: 0.7, sideItemAlpha: 0.6, sideItemShift: 0.0)

The animation apply following 2 here

  1. Scale
  2. Rotation
  • spacingMode (default is fixed spacing of 40 pts) Can be set only through code.
  • SJCenterFlowLayoutSpacingMode.fixed(spacing: CGFloat) Items in the carousel are positioned with a fixed space between them.
  • SJCenterFlowLayoutSpacingMode.overlap(visibleOffset: CGFloat) A fixed part of the side items are visible on the sides of the collection (and therefore the space between items depends on the collection size).

Scale Animation (With cells scale animation while scrolling)

  • Set the animation mode for collectionview flow layout
centerFlowLayout.animationMode = SJCenterFlowLayoutAnimation.scale(sideItemScale: 0.6, sideItemAlpha: 0.6, sideItemShift: 0.0)
  • Set the rotation scale, alpha of collectionView as per your need

Rotation Animation (With cells rotation animation while scrolling)

  • Set the animation mode for collectionview flow layout
centerFlowLayout.animationMode = SJCenterFlowLayoutAnimation.rotation(sideItemAngle: 45, sideItemAlpha: 0.6, sideItemShift: 0)
  • Set the rotation angle, alpha of collectionView as per your need

Detect current indexPath or page while scrolling

  • If you continue to track which current(center) indexPath then use scrollViewDidScroll delegate method. This method called on any offset changes.
func scrollViewDidScroll(_ scrollView: UIScrollView) {
        if let indexPath = centerFlowLayout.currentCenteredIndexPath {
            print("Current IndexPath: \(indexPath)")
        }
        if let page = centerFlowLayout.currentCenteredPage {
            print("Current Page: \(page)")
        }
    }
  • After scrolling end with left or right then you can use the scrollViewDidEndDecelerating delegate method. This method called when scroll view grinds to a halt.
// 
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        if let indexPath = centerFlowLayout.currentCenteredIndexPath {
            print("Current IndexPath: \(indexPath)")
        }
        if let page = centerFlowLayout.currentCenteredPage {
            print("Current Page: \(page)")
        }
    }

Scroll to specifc index

scrollToPage(atIndex index: Int, animated: Bool = true) method use to scroll specific index.

centerFlowLayout.scrollToPage(atIndex: 2, animated: true)

Author

Sandeep Joshi - https://github.com/yudiz-solutions

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].