Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Please Provide Obj-c exmple #43

Open
joyalserrao opened this issue Sep 26, 2016 · 1 comment
Open

Please Provide Obj-c exmple #43

joyalserrao opened this issue Sep 26, 2016 · 1 comment

Comments

@joyalserrao
Copy link

No description provided.

@daoseng33
Copy link

For version 0.6.1 with Swift 3.0

1.Added @objc before
public protocol RAReorderableLayoutDelegate: UICollectionViewDelegateFlowLayout
and
public protocol RAReorderableLayoutDataSource: UICollectionViewDataSource

the code will be:

@objc public protocol RAReorderableLayoutDelegate: UICollectionViewDelegateFlowLayout
@objc public protocol RAReorderableLayoutDataSource: UICollectionViewDataSource

2.setup your collection view delegate and datasource(Use RAReorderableLayout as its layout)

collectionView.delegate = self;
collectionVeiw.datasource = self;

You don't need to do something like
layout.delegate = self
at this version

3.Put all the delegate & datasource method into your view controller

Datasource:

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section;
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAt:(NSIndexPath *)indexPath;
- (CGFloat)collectionView:(UICollectionView *)collectionView reorderingItemAlphaInSection:(NSInteger)section;
- (UIEdgeInsets)scrollTrigerPaddingInCollectionView:(UICollectionView *)collectionView;
- (UIEdgeInsets)scrollTrigerEdgeInsetsInCollectionView:(UICollectionView *)collectionView;
- (CGFloat)scrollSpeedValueInCollectionView:(UICollectionView *)collectionView;

Delegate:

- (BOOL)collectionView:(UICollectionView *)collectionView allowMoveAt:(NSIndexPath *)indexPath;
- (BOOL)collectionView:(UICollectionView *)collectionView at:(NSIndexPath * _Nonnull)at canMoveTo:(NSIndexPath * _Nonnull)canMoveTo;
- (void)collectionView:(UICollectionView *)collectionView at:(NSIndexPath *)at didMoveTo:(NSIndexPath *)toIndexPath;
- (void)collectionView:(UICollectionView *)collectionView collectionView:(RAReorderableLayout *)layout willEndDraggingItemTo:(NSIndexPath * _Nonnull)indexPath;
- (void)collectionView:(UICollectionView *)collectionView collectionView:(RAReorderableLayout *)layout didEndDraggingItemTo:(NSIndexPath *)indexPath;
- (void)collectionView:(UICollectionView *)collectionView collectionView:(RAReorderableLayout *)layout willBeginDraggingItemAt:(NSIndexPath *)indexPath;
- (void)collectionView:(UICollectionView *)collectionView collectionView:(RAReorderableLayout *)layout didBeginDraggingItemAt:(NSIndexPath * _Nonnull)indexPath;
- (void)collectionView:(UICollectionView *)collectionView at:(NSIndexPath * _Nonnull)at willMoveTo:(NSIndexPath * _Nonnull)toIndexPath;

Then do what you need in all these methods.
P.S. some method you don't need could be just empty

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants