Code Monkey home page Code Monkey logo

jzswipecell's Introduction

JZSwipeCell

Overview

Inspired by MailboxApp (http://mailboxapp.com). A UITableViewCell subclass that makes it easy to add long, short, left and right swiping of content in your table views. Features 4 swipe zones with customizable icons, colors and sizes.

Getting Started

Simple to use. Just subclass JZSwipeCell and add 2 lines of code to add your images and colors.

self.imageSet = SwipeCellImageSetMake([UIImage imageNamed:@"image1"],
									  [UIImage imageNamed:@"image2"],
									  [UIImage imageNamed:@"image3"],
									  [UIImage imageNamed:@"image4"]);

self.colorSet = SwipeCellColorSetMake([UIColor greenColor],
										  [UIColor redColor],
										  [UIColor brownColor],
										  [UIColor orangeColor]);

Then just implement 1 delegate method to receive messages when a swipe is detected.

- (void)swipeCell:(JZSwipeCell*)cell triggeredSwipeWithType:(JZSwipeType)swipeType
{
	if (swipeType != JZSwipeTypeNone)
	{
		NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
		[tableData removeObjectAtIndex:indexPath.row];
		[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
		
		// add conditional statement for swipeType
	}	
}

You can also trigger the swipe animation to run without any swipe occurring.

JZSwipeCell *cell = (JZSwipeCell*)[self.tableView cellForRowAtIndexPath:indexPath];
[cell triggerSwipeWithType:JZSwipeTypeShortRight];

Take a look at the examples for more info. There is one example of subclassing JZSwipeCell with a xib and another without.

Creator

Jeremy Zedell

License

JZSwipeCell is available under the MIT license. See the LICENSE file for more info.

jzswipecell's People

Contributors

jlz avatar

Watchers

James Cloos avatar  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.