【问题标题】:UITableView touch position or several gestures at a timeUITableView 一次触摸位置或几个手势
【发布时间】:2015-05-06 22:23:46
【问题描述】:

我有 UITableView,并添加了移动单元格的功能。

http://s017.radikal.ru/i402/1503/76/3442a9517cec.png

所以,如果 longPressGesture 被识别,我将单元格隐藏,拍摄单元格的快照(在图片上以灰色突出显示),并在 longPressGestureStateChanged 时更改它的位置。但是移动的动画看起来很糟糕。

如果我在 longPressGestureBegan 时添加 panGesture,直到我再次触摸和触摸后它才会起作用,然后 panGestureStateChanged 开始工作,并且移动变得平滑。

我需要 panGesture 在 longPressGestureBegan 时开始工作,或者捕捉屏幕触摸位置。

但难点在于:(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;等等...在 UITableView 上不起作用。

我读了很多书,但没有任何根据。这是定制案例。例如,我需要仅在识别出 longPressGesture 时才识别 pinchGesture,而无需进行修饰。

有人知道怎么解决吗?

【问题讨论】:

    标签: ios objective-c uitableview touch gesture


    【解决方案1】:

    对于UITableView,使用准备好的方法来移动单元格。您可以在the documentation找到更多信息。

    【讨论】:

    • 我需要在 tableViewEditingStyle = NO 时移动单元格。这就是我尝试这样做的原因。另外我有一个自定义滑动的自定义单元格,所以在可编辑模式下修改表格视图的样式不适合我
    猜你喜欢
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 2015-05-31
    • 2018-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多