• Stars
    star
    1,835
  • Rank 25,289 (Top 0.5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

ListDiff

Swift port of IGListKit's IGListDiff
Swift
238
star
2

LXPagingViews

A small, efficient and flexible implementation for common paging scroll view patterns.
Objective-C
65
star
3

LXReceiptStore

Built on top of CargoBay, LXReceiptStore provides a simpler interface aims at helping you make sense out of your In-App Purchase receipts.
Objective-C
23
star
4

AdvancedUserInterfacesUsingCollectionView

WWDC 2014 Session 232
Objective-C
7
star
5

LXSupport

A project aspired to be the ActiveSupport of Cocoa.
Objective-C
7
star
6

ToolingInSwift

A talk that I gave at iOS Conf SG on 24th Oct 2015.
Shell
6
star
7

SVShareViewController

A simple compose UI for posting textual content to Facebook and Twitter.
Objective-C
6
star
8

sgbusroutes

Objective-C
5
star
9

LXXcodeTools

The bridge between Xcode CLI Tools and Swift.
Swift
3
star
10

LXStateMachine

A simple event-driven mealy state machine.
Swift
2
star
11

UIKitGuard

Guard against accessing UIKit on threads other than main.
Objective-C
2
star
12

inspect-3rd-party-app

2
star
13

zookeeper-consul-docker

ZooKeeper coordinated using Consul
Python
2
star
14

UI-Automation-on-CI

Attempts to run UI Automation on Travis CI.
Objective-C
2
star
15

LXNetwork

Swift
2
star
16

ReactNativeBug-NestedViewInTextInput

JavaScript
1
star
17

LXDeltaCalculation

To calculate the differences between 2 collections. A clone of BKDeltaCalculator.
Objective-C
1
star
18

xcode_manager

A framework for writing automated tasks for managing Xcode projects.
Ruby
1
star
19

LXSupportKit

A collection of codes to support my iOS development.
Objective-C
1
star
20

modern-react-with-redux

JavaScript
1
star
21

ComposeKit

Swift Port of Composable Data Sources
Swift
1
star
22

nextid

Smallest(Possible IDs - Used IDs)
Java
1
star
23

ReactNative-AndroidKeyPress

example project to show a KeyPress bug in Android for React Native 0.53.3
Objective-C
1
star
24

docker-swift

1
star
25

TicTacToe

A simple Tic Tac Toe iPhone app I developed while learning iOS Development. Using Xcode 3.x.x.
Objective-C
1
star
26

kafka-docker

Yet another Kafka's Docker repository
Shell
1
star
27

ios-mac-osx-tips-and-tricks

I want to write a book some day, here is where I start. A collection of tips and tricks I have learnt about iOS and Mac OS X development.
1
star
28

react-native-awesome-project

react-native init AwesomeProject --version ${REACT_NATIVE_VERSION}
Objective-C
1
star