Skip to content

UICollectionViewLayout that performs scaling up and down automatically on disappearing cells, and applies UIDynamics.

License

Notifications You must be signed in to change notification settings

forrHuen/SACollectionViewVerticalScalingFlowLayout

Repository files navigation

SACollectionViewVerticalScalingFlowLayout

VersionLicensePlatformBitdeli Badge

About

SACollectionViewVerticalScalingFlowLayout applies scaling up or down effect to appearing or disappearing cells. In addition, animation of UIDynamics applies each cell.

sample1sample2

ManiacDev.com referred.
https://maniacdev.com/2015/07/open-source-uicollectionview-layout-that-automatically-scales-images-scrolling-inout-of-view

Features

  • Vertical Scaling
  • Rewrite in Swift
  • Support Horizonal Scaling

Installation

CocoaPods

SACollectionViewVerticalScalingFlowLayout is available through CocoaPods. If you have cocoapods 0.36.0 or greater, you can install it, simply add the following line to your Podfile:

pod "SACollectionViewVerticalScalingFlowLayout" 

Manually

Add the SACollectionViewVerticalScalingFlowLayout directory to your project.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

From Storyboard or Xib

Go to 'Attributes Inspector' of Storyboard or Xib, and set Layout tab 'Custom'. And set class tab 'SACollectionViewVerticalScalingFlowLayout'.

Alert

From Code

Write this code at viewDidLoad method and so on.

collectionView.registerClass(SACollectionViewVerticalScalingCell.self, forCellWithReuseIdentifier:kCellIdentifier)letlayout=SACollectionViewVerticalScalingFlowLayout() layout.scaleMode =.Hard layout.alphaMode =.Easy layout.scrollDirection =.Vertical collectionView.collectionViewLayout = layout 

if you want to use Horizontal mode.

layout.scrollDirection =.Horizontal

Customization

You can customize scaling and alpha of apearing or disapering cells.

For Scale

You can change alpha to set ScaleModeType for scaleMode property of SACollectionViewVerticalScalingFlowLayout.(default: .Easy)

varscaleMode:SACollectionViewVerticalScalingFlowLayoutScaleModeenumSACollectionViewVerticalScalingFlowLayoutScaleMode{case None, Easy, Hard }

For Alpha

You can change alpha to set AlphaModeType for alphaMode property of SACollectionViewVerticalScalingFlowLayout. (default: .Easy)

varalphaMode:SACollectionViewVerticalScalingFlowLayoutScaleModeenumSACollectionViewVerticalScalingFlowLayoutAlphaMode{case None, Easy, Hard }

For Cell

You use containerView instead of contentView like this code, then you can add what kind of view you want to add.

letcell= collectionView.dequeueReusableCellWithReuseIdentifier(kCellIdentifier, forIndexPath: indexPath)letimageView=UIImageView(frame: cell.bounds) imageView.image =UIImage(named:"cat") cell.containerView?.addSubview(imageView)

Requirements

  • Xcode 6.3 or greater
  • iOS7.0(manually only) or greater
  • ARC

Author

Taiki Suzuki, [email protected]

License

SACollectionViewVerticalScalingFlowLayout is available under the MIT license. See the LICENSE file for more info.

About

UICollectionViewLayout that performs scaling up and down automatically on disappearing cells, and applies UIDynamics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift67.4%
  • Shell23.7%
  • Ruby4.4%
  • Objective-C2.4%
  • C2.1%