Back to rankings

lxcid/LXReorderableCollectionViewFlowLayout

Objective-Clxcid.com

Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.

uicollectionviewreorderingibooksobjective-cdrag-and-dropuicollectionviewlayout
Star Growth
Stars
1.9k
Forks
317
Weekly Growth
Issues
46
5001k1.5k
Oct 2012May 2017Dec 2021Jul 2026
README

LXReorderableCollectionViewFlowLayout

Extends UICollectionViewFlowLayout to support reordering of cells. Similar to long press and pan on books in iBook.

Features

The goal of LXReorderableCollectionViewFlowLayout is to provides capability for reordering of cell, similar to iBook.

  • Long press on cell to invoke reordering capability.
  • When reordering capability is invoked, fade the selected cell from highlighted to normal state.
  • Drag around the selected cell to move it to the desired location, the other cells adjust accordingly. Callback in the form of delegate methods are invoked.
  • Drag selected cell to the edges, depending on scroll direction, scroll in the desired direction.
  • Release to stop reordering.

Getting Started

Screenshot
  1. Install using CocoaPods or drag the LXReorderableCollectionViewFlowLayout folder into your project.

  2. Initialize/Setup your collection view to use LXReorderableCollectionViewFlowLayout.

  3. The collection view controller that is to support reordering capability must conforms to LXReorderableCollectionViewDataSource protocol. For example,

    - (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath {
        id object = [mutableArray objectAtIndex:fromIndexPath.item];
        [mutableArray removeObjectAtIndex:fromIndexPath.item];
        [mutableArray insertObject:object atIndex:toIndexPath.item];
    }
    
  4. You can listen to some dragging events through comforming to LXReorderableCollectionViewDelegateFlowLayout methods.

  5. Setup your collection view accordingly to your need, run and see it in action! :D

Changes

Feb 24 2013 (Luke Scott)

  • Removed setUpGestureRecognizersOnCollectionView
  • Removed layout from delegate methods (can be accessed from collectionView)
  • Renamed delegate methods and split between dataSource and delegate
  • Added dataSource and delegate examples to sample project

Feb 23 2013 (Luke Scott)

  • Refactored everything to be more readable / maintainable
  • Deprecated setUpGestureRecognizersOnCollectionView - no longer necessary

Requirements

  • ARC
  • iOS 6 and above preferred
  • Xcode 4.5 and above

Credits

Alternatives

License

LXReorderableCollectionViewFlowLayout is available under the MIT license.

Related repositories
Instagram/IGListKit

A data-driven UICollectionView framework for building fast and flexible lists.

Objective-CMIT Licenseuicollectionviewios
instagram.github.io/IGListKit/
13.1k1.5k
Juanpe/SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

SwiftMIT Licenseswiftskeleton
12.9k1.1k
WenchaoD/FSPagerView

FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.

SwiftMIT Licenseswiftobjective-c
7.4k1.1k
marcosgriselli/ViewAnimator

ViewAnimator brings your UI to life with just one line

SwiftMIT Licenseiosswift
7.3k486
KelvinJin/AnimatedCollectionViewLayout

A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.

SwiftMIT Licenseswiftuicollectionview
4.9k346
chiahsien/CHTCollectionViewWaterfallLayout

The waterfall (i.e., Pinterest-like) layout for UICollectionView.

Objective-CMIT Licenseuicollectionviewpinterest
4.6k689
SoySauceLab/CollectionKit

Reimagining UICollectionView

SwiftMIT Licenseiosswift
4.5k265
youngsoft/MyLinearLayout

MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView RTL

Objective-CMIT Licenseautolayoutandroid
4.4k888
roberthein/BouncyLayout

Make. It. Bounce.

SwiftMIT Licensecollectionview
4.2k196
rechsteiner/Parchment

A paging view with a highly customizable menu ✨

SwiftMIT Licenseswiftios
3.5k431
Yalantis/Persei

Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift

SwiftMIT Licenseiosswift
yalantis.com
3.4k309
tigerAndBull/TABAnimated

A skeleton screen loading framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)

Objective-CMIT Licenseobjective-cios
3.4k539