Coder Social home page Coder Social logo

reorderingtableviewcontroller's Introduction

ATSDragToReorderTableViewController
Daniel Shusta
Acacia Tree Software
<my first name> @ acaciatreesoftware.com


ATSDragToReorderTableViewController is a UITableViewController subclass that adds drag and drop reordering to a UITableView. 

I developed it as part of Acacia Tree Software’s SousChef for iPhone so rest assured I am eating my own dogfood with this.

A UITableView with this functionality can be reordered without switching into edit mode. It’s simply a press and hold to start, then drag the cell to reorder. The UITableView automatically scrolls when approaching the top or bottom of the UITableView.

=====

It is straightforward to incorporate into your app. 

	1.  Instead of subclassing from UITableViewController, you subclass from ATSDragToReorderTableViewController. 

	2.  Then implement the UITableViewDataSource method -tableView:moveRowAtIndexPath:toIndexPath: . You might have already done this.

	3.  And make sure the subclass calls [super viewDidUnload] from -viewDidUnload (I think Xcode’s UITableViewController template used to not do this.)

The included sample app includes these changes as a demonstration. Further details are described at the top of the ATSDragToReorderTableViewController.h .

For those curious, ATSDragToReorderTableViewController.m includes a fairly comprehensive overview of the implementation at the top and is ridiculously over-commented throughout.

=====

ATSDragToReorderTableViewController relies on UIGestureRecognizer and uses block-based animations throughout, so it requires iOS 4.0 SDK as minimum. 

It was made for and tested on iPhone. I haven’t a clue about iPad but I expect it will probably work.

Licensing info is at the very top of the files. It is pretty easy-going, I think. 

=====

I am trying to be reserved here but I am pretty excited about this and hope you find this exciting too.

Cheers,
Daniel Shusta

reorderingtableviewcontroller's People

Contributors

shusta avatar

Stargazers

SG7 avatar

Watchers

James Cloos avatar SG7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.