MCSwipeTableViewCell
An effort to show how one would implement a UITableViewCell like the one we can see in the very well executed Mailbox iOS app.
Preview
Exit Mode
The exit mode MCSwipeTableViewCellModeExit
is the original behavior we can see in the Mailbox app. Swiping the cell should make it disappear. Convenient in destructive modes.
Switch Mode
The switch mode MCSwipeTableViewCellModeSwitch
is a new behavior I'm introducing. The cell will bounce back after selecting a state, this allows you to keep the cell. Convenient to switch an option quickly.
API Reference
Please refer to the header file MCSwipeTableViewCell.h
for a complete overview of the capabilities of the class.
Usage
Delegate
MCSwipeTableViewCell has a set of delegate methods in order to track the user behaviors. Take a look at the header file to be aware of all the methods provided by MCSwipeTableViewCellDelegate
.
Cell Deletion
In MCSwipeTableViewCellModeExit
mode you may want to delete the cell with a nice fading animation, the following lines will give you an idea how to execute it:
You can also ask for a confirmation before deleting a cell:
Then handle the UIAlertView
action:
There is also an example in the demo project, I recommend to take a look at it.
Changing the trigger percentage
If the default trigger limits do not fit to your needs you can change them with the firstTrigger
(default: 25%) and secondTrigger
(Default: 75%) properties.
Reseting cell position
It is possible to put the cell back to it's position when using the MCSwipeTableViewCellModeExit
mode with the -swipeToOriginWithCompletion:
method:
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects.
To integrate MCSwipeTableViewCell into your Xcode project using CocoaPods, specify it in your Podfile
:
Then, run the following command:
Carthage
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
To integrate MCSwipeTableViewCell into your Xcode project using Carthage, specify it in your Cartfile
:
Compatibility
This library is not compatible with auto-layout so you will need to disable auto-layout in your xib properties.
Requirements
- iOS >= 5.0
- ARC
Contact
Ali Karagoz