HPReorderTableView

by hpique

Drop-in UITableView replacement to reorder cells with long press on any part of the cell

205 Stars 41 Forks Last release: Not found Apache License 2.0 37 Commits 3 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

HPReorderTableView

Version Platform Build Status

Drop-in UITableView replacement to reorder cells with long press on any part of the cell.

Reordering animation

Installation

Using CocoaPods:

pod 'HPReorderTableView', '~> 0.2'

Or add the files from the HPReorderTableView directory if you're doing it manually.

Usage

Simply instance

HPReorderTableView
instead of
UITableView
:
UITableView *tableView = [[HPReorderTableView alloc] init];

Or if you're using interface builder, change the class of the table view to

HPReorderTableView
.

Then implement the reordering methods of your table view data source as you would normally do if you were using the default reorder behavior. For example:

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
    [_objects exchangeObjectAtIndex:sourceIndexPath.row withObjectAtIndex:destinationIndexPath.row];
}

Customization

See the documentation for customization options.

Requirements

HPReorderTableView requires iOS 6.1 or above and ARC.

License

Copyright 2014 Hermes Pique (@hpique)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Uses code from BVReorderTableView by bvogelzang.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.