Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tweetie like swipe menu

How can I implement tweetie like swipe menu?

I'm done with developing a tableviewcontroller with a customcell. The customcell implements touchesbegan and touchesMoved. It also reports swipe gestures via a selector to the parent tableviewcontroller.

Now how should I go about hiding the "Swiped" cell and replacing it with a "swipe menu view" and how should I get the actions from the buttons present on the swipeview?

like image 235
Mugunth Avatar asked Jun 01 '09 03:06

Mugunth


2 Answers

Each table view cell has a contentView that encompasses the whole area of the cell. Add your swipe-menu view as a single container view with an opaque background to the contentview so it's on top of everything else. Position it so it's flush left (x=0), set the width to 0, and set it as hidden. That single container can include any other subview (buttons, etc) and you can set the cell view itself as the target of the button events (then bubble it up to the parent table view along with cell index information).

When time comes to show it, set it to not hidden then use UIView animation to make the container width go from 0 to full table width. Set the duration pretty low (i.e. 0.2 seconds) so it's zippy. When you run the animation, the swipe-menu shows up over everything else in the cell content view. To make it disappear just reverse it (set the width to 0 in a UIView BeginAnimation block). You may also want to set an animation completion handler at the end and do some housekeeping there (set the container view to hidden, release memory, etc).

like image 56
Ramin Avatar answered Nov 18 '22 17:11

Ramin


I've done a tweetie like menu, there's no full code but i blogged about it. Hope it helps!

http://petersteinberger.com/2010/01/tweetie-like-swipe-menu-for-iphone-apps/

like image 31
steipete Avatar answered Nov 18 '22 19:11

steipete