开发者

Collapse UITableViewCells while dragging

I have the following structure in a UITableView:

Recipe 1:
--> Ingredient a
--> Ingredient b
--> Ingredient c
Recipe 2:
--> Ingredient d
--> Ingredient e

Recipes and ingredients are both UITableViewCells and you can press on a button that is displayed in the Recipe cell to collapse or expand the Recipe and hide or show its ingredients.

When I'm in edit mode, I want to be able to reorder Recipes using the native drag feature available in UITableView. When a user start dragging a Recipe, if it is expanded, I need it to be collapsed. However, I can't detect when dragging starts (to collapse the Recipe).

I've tried using a UILongPressGestureRecognizer with a minimumPressDuration = 0 and if the touch event ocurrs in the zone where cell's reorder accessory view is displayed I collapse de Recipe. However, when I detect the tap, if I change the datasource and rel开发者_运维百科oad the UITableView to collapse the Receipe the dragging is interrupted.

Any idea? Thanks in advance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜