bits about life, coding and stuff
Update: Download a nice implementation here.
If you’ve ever used Tweetie 2 on the iPhone, you surely love Loren’s unique menu approach. Facebook has something like that, but it’s displayed via a button. For my app, i wanted to bring users the same experience like on the iphone.
I assume you have some iphone dev experience, this isn’t going to be a step by step guide.
First, I am using three20 and their show/hideMenu implementation. This already helps a lot. Next, make your UICells SOLID. One big UIView that draws everything custom. This is a good advice anyhow, it will stop weird things happening when you draw the menu (believe me…) and your list will scroll like butter. Apple updated their docs, so now the last (5th) example does the same as atebits did.
Next, we need to custom detect the horizontal swipe. Use this as a start and put your code into the cell controller. I’m communicating to the source cell via NSNotifications, but that’s up to you how you do it.
Third, and thats the trick making a good swipe menu is to temporary disable scrolling on the tableView. If you don’t, people have to be very careful not to close the menu after swiping (a vertical swipe closes the menu, this is expected behavior)
I am overriding the showMenu of an TTTableViewController to add the scrollEnabled=NO (and some other handy things)
Now, don’t forget to re-enable the scrolling after the touch actually ended. Put it into the CellController.
This took me quite a while. My beta-testers told me they had a “hard time” really opening the menu and some were really pissed
We learn: the little things make all difference!
Related posts: