Latest 3.0.1
Homepage https://github.com/amichnia/AMKSlidingTableViewCell
License MIT
Platforms ios 8.0, requires ARC
Authors , ,

Customizable sliding cell behavior. Based on MKSlidingTableViewCell, adds few new options. Now you can add transformable behavior – for drawer and foreground cell (whole, or its part) which are being 3D transformed – giving you nice, clean look, and several options to customize it:

Screenshots:

Custom style Screenshot
Cosmetic Scan Screenshot

Usage

Setup – cells

Create cells, that conforms to given structure:

  1. Container as MKSlidingTableViewCell – this is empty container for foreground and background cells.

  2. Foreground as subclass of MKActionTableViewCell – this is what actually is shown in the cell. To work, you have to set valid auto-layout, and connect outlets. In case of foreground, not connecting outlets will only result in no 3D transform for foreground.

    1. actionContainer: this is main container (optional if no transformable)

    2. transformableContainer: this should be same size as actionContainer, everything inside is being 3D transformed (optional)
  3. Backgorund as subclass of MKActionTableViewCell – this is what gets revealed, when cell is sliding.

    1. actionContainer: this is main container, its size determines, how much cell will slide (required)

    2. transformableContainer: this should be same size as actionContainer, everything inside is being 3D transformed (optional)

Storyboard

Code

When the cells are prepared, (storyboard or XIB) – you create actual sliding cells like below:

Objective-C

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MKSlidingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"container"];
    UITableViewCell *foregroundCell = [tableView dequeueReusableCellWithIdentifier:@"foreground"];
    UITableViewCell *backgroundCell = [tableView dequeueReusableCellWithIdentifier:@"background"];

    cell.foregroundView = foregroundCell;
    cell.drawerView = backgroundCell;
    cell.delegate = self;

    //configure cells

    return cell;
}

Swift

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    guard let
    containerCell = tableView.dequeueReusableCellWithIdentifier("container") as? MKSlidingTableViewCell,
    foregroundCell = tableView.dequeueReusableCellWithIdentifier("foreground") as? MKActionTableViewCell, // Or its subclass
    drawerCell = tableView.dequeueReusableCellWithIdentifier("background") as? MKActionTableViewCell  // Or its subclass
    else {
        return UITableViewCell()
    }

    containerCell.foregroundView = foregroundCell
    containerCell.drawerView = drawerCell
    containerCell.delegate = self

    return containerCell
}

Handling Taps on Cell

Objective-C:

- (void)didSelectSlidingTableViewCell:(MKSlidingTableViewCell *)cell
{
    //cell tapped!
}

Swift:

func didSelectSlidingTableViewCell(cell: MKSlidingTableViewCell!) {
    print("Did select")
}

Notifications

Objective-C

//Add observers
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRevealDrawerViewForCell:) name:MKDrawerDidOpenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didHideDrawerViewForCell:) name:MKDrawerDidCloseNotification object:nil];

- (void)didRevealDrawerViewForCell:(NSNotification *)notification
{
    MKSlidingTableViewCell *cell = notification.object;

    //additional code
}

- (void)didHideDrawerViewForCell:(NSNotification *)notification
{
    MKSlidingTableViewCell *cell = notification.object;

    //additional code
}

Credits

This fork and updates to AMKSlidingTableViewCell are created by Andrzej Michnia.

Original MKSlidingTableViewCell was created by Michael Kirk with contributions by Sam Corder.

License

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

Latest podspec

{
    "name": "AMKSlidingTableViewCell",
    "version": "3.0.1",
    "summary": "An iOS 8+ compatible sliding table view cell that adds sliding behaviours with 3d transforms.",
    "description": "Allows composiitons of custom cells (foregorund and background) into one sliding cell, with anything in the drawer part. It also provides easy way (just connect an outlet), to have drawer and feoreground 3D transformation effect - clean an modern.",
    "homepage": "https://github.com/amichnia/AMKSlidingTableViewCell",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Andrzej Michnia": "[email protected]",
        "Michael Kirk": "[email protected]",
        "Sam Corder": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/amichnia/AMKSlidingTableViewCell.git",
        "tag": "3.0.1"
    },
    "source_files": "MKSlidingTableViewCell/Source",
    "requires_arc": true
}

Pin It on Pinterest

Share This