Giter VIP home page Giter VIP logo

hhpanningtableviewcell's Introduction

HHPanningTableViewCell - Swipe to reveal

HHPanningTableViewCell is a UITableViewCell implementing "swipe to reveal" a drawer view. Such a view typically holds action buttons applying to the current row.

This behavior is seen in a number of iOS applications. To my knowledge the idea was pioneered by Loren Brichter for Tweetie (aka Twitter for iPhone).

The HHPanningTableViewCell implementation was written for the ACTPrinter 4.0 application. The code presented here is identical to the one used in the shipped product.

Features

  • Swipe to reveal implemented using gesture recognizer
  • Live tracking of swipe to progressively reveal drawer
  • Options to allow for swiping to left or right only
  • Bounce animation when hiding drawer
  • Foreground view casts shadow on drawer when moved aside

Requirements

  • iOS 6.1 or later. Including 7.0 (Tag 1.0.0 did support iOS 5.1)
  • ARC memory management

Usage

  • Copy the following to your project:
    • HHDirectionPanGestureRecognizer.h
    • HHDirectionPanGestureRecognizer.m
    • HHInnerShadowView.h
    • HHInnerShadowView.m
    • HHPanningTableViewCell.h
    • HHPanningTableViewCell.m
  • Use HHPanningTableViewCell instances for your table cells
  • Set a panning direction mask on the cells
  • Provide a drawer view for the cells
  • Optionally, implement the HHPanningTableViewCellDelegate method to trigger your own custom action.
  • Refer to the demo application for details

License

This code is made available under the terms of the BSD license as included in the source files.

hhpanningtableviewcell's People

Contributors

georgemp avatar gloubibou avatar itsniper avatar lucasderraugh avatar mpurland avatar snowyote avatar zhigang1992 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hhpanningtableviewcell's Issues

Cell crashing

screen shot 2013-09-25 at 6 27 15 pm
[containerView insertSubview:subview atIndex:0]; on line 617 causing crash in IOS 7

Is it possible to just half reveal the cell?

Is it possible to reveal just half the cell and half cell remains on the screen instead of disappearing.

It means first half will be the drawer view and second half will be the main cell .

Storyboard Cells & autolayout example

is there any example about how to implement it with custom cells in storyboard ? Already did it via code but couldn't succeed in storyboard. Objects in the contentView of the cell disappear after swiping and become not visible anymore except during the swipe reveal.

Add property to change HH_PANNING_MINIMUM_PAN?

Hi, first I'd like to say thanks for the great library!

I've been using it a bit in my latest project, though in this project I need to set the minimum pan distance for revealing the drawer.

I've updated the class on my local machine so you can set the minimum pan via a property (instead of the variable being a #define). Did you want me to send you a pull request for this?

Thanks
Jerrold

Incompatibility with SVPullToRefresh

Hi, I'm using this component along with SVPullToRefresh.

What happens is that after refreshing the tableview by pulling it, the cells are not swipable anymore, although the drawerView is present on every cell.

Any idea of why this is happening?

Tableview reloadData causes issues

If you call reloadData on the table view and the first row has shown the drawer, when reloadData is finished the first row will not do any panning and will show the drawer only.

screen shot 2014-01-22 at 11 57 05 am

Programatically close???

Not so much an issue as this is a question...is there a way to programmatically close the cell from the UITableView once it's been revealed?

Brief "Flash" when sliding back to not revealed state

Great Work!

I did a small customization to slide the cell only half way upon the "revealed" state.

In doing so, when I swipe the cell back to its "unrevealed" state, there is a very brief flash of the cell's view, probably because the subviews being added.

I cannot figure out how to prevent this "flash". Any thoughts?

Thanks!

Additional box shown on panning after rotation

If I do the following, an extra box is seen in the drawer view

  1. Pan to show drawer view
  2. Close drawer view
  3. Rotate device
  4. Pan to show drawer view

The box is more prominently seen with tableView cell's that are taller than the default. Is there a way to avoid this? Thanks

Screenshot from the demo app is attached

hhpanningtableviewcell after rotation

Cell separators not shown on iOS7

Hi! Thank you for sharing the code.

I'm experimenting with HHPTVC & iOS7 and I noticed that the cell separators are not shown, even in the demo app. Is that an intended behaviour? Have you any suggestions to restore the separators?

Regards,
MB

Scrolling causes drawerView to be displayed

On the demo project (in iOS 7), scroll all the way to the bottom and then back up again. In a few times of doing this, I start seeing the drawerView displayed on some rows that are newly displayed as they scroll by. I am not sure what is triggerring this. I see this a lot more often (don't have to scroll as much) in my app, but, am able to trigger this in the demo app as well. Any ideas? Thanks

How to limit the reveal area?

Hello,
Thanks for sharing this code.. :)
Is it possible to leave a part of the cell "unrevealed" when you swipe the cell instead of having the entire cell revealed?
Thanks once again.

Using with a CustomCell with AutoLayout

I tried to implement a custom tableviewcell by inheriting HHPanningTableViewCell I met two bugs:

  • The pan gesture label seems not working
  • And the second, at the launch of the application, click directly on a TableCell to change views. Go back and try to swipe on a cell.. labels disappear.

Test on IOS6 with a storyboard. An empty project with the 2 bugs: http://www.filedropper.com/test_9

Drawer View being shown at random on refresh/delete

Hi,
I've been trying to track down the issue on this for a while, but, have been pretty unsuccessful. In my app, the drawer view shows up at random on refreshing/deleting cells from the tableview. I have modified the bundled demo app on a fork to demonstrate the problem.
https://github.com/georgemp/HHPanningTableViewCell/tree/drawerIssues
This demo app in this case allows refresh. But, if you refresh (might have to do it a few times), sometimes the new cell is displayed with the drawerView show. I would appreciate any ideas on how to prevent this. Thanks

Demo app in iOS7

The demo app doesn't work in iOS7. It crashes directly when I try to start it in the iOS7 simulator.

Unknown UIView animation when closing "left swipe cell"

When I swipe back "left cell" there is a undetermined UIView animation in background. I didn't notice it until I set cell background to be transparent. It seams that shadowView is causing the problem but I can't determine why.

You can observe it you set HH_PANNING_ANIMATION_DURATION to 1.f and containerView alpha to .4 in createContainerView. Also colouring all the views makes it really easy to see.

I gave it a try to fix it, but had no luck. Maybe this problem is also causing the "Flash" from issue#13.

Interference of gestures (GestureRecognizer and several Touches)

Hi,

I really like your approach but I got some problems:

  1. If you use a 2-finger (or more) swipe gesture on tableview it is possible to reveal several drawer views at the time ...
  2. I have a 2 finger swipe gesture on self.view but I can't manage to make HHPanningTableViewCell (tableView) to react only on one touch - currently my gesture on self.view and on (several) HHPanningTableViewCell will fire at the same time

Basically both problems are connected due the interference of swipe gestures...

UIStoryboards and reusing cells problem

I am using storyboards and dynamic cells, this line does not work because cells are never nil when using dynamic prototype cells and cell identifier, and therefore, HHPanningTableViewCell is not working.

With what should I replace these lines of code to make it work?

if (cell == nil) {
cell = [[HHPanningTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];

    UIView *drawerView = [[UIView alloc] initWithFrame:cell.frame];

    // dark_dotted.png obtained from http://subtlepatterns.com/dark-dot/
    // Made by Tsvetelin Nikolov http://dribbble.com/bscsystem
    drawerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"dark_dotted"]];

    cell.drawerView = drawerView;       
}

HHInnerShadowView is highly inefficient

I implemented this table view cell and tried it on an iPhone 4S, and it too a really long time to create this view. The drawRect: method was the culprit, according to instruments, and needs to be revised. I had to throw out this view in my implementation.

Cocoapods broken

When installing with
pod 'HHPanningTableViewCell'
It includes AppDelegate.* files and causes linker errors.
I assume cocoapods master repo should be updated with .podspec from this repo.

HHCell not disposing

When I call

[tableView deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationLeft];

I get a box of the HHInnerShadow overlay on my tableview. It only sticks out a little. I imagine as much as the offset (inset) of the drop shadow is. When I look at the UI in reveal (revealapp.com), I see that the tableview part has been disposed, but the HHViews are all still retained. Any suggestions?

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.