Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在编辑模式下暂停/禁用UITableViewCell上的UILongPressGestureRecognitor_Iphone_Uitableview_Uigesturerecognizer_Long Press - Fatal编程技术网

Iphone 如何在编辑模式下暂停/禁用UITableViewCell上的UILongPressGestureRecognitor

Iphone 如何在编辑模式下暂停/禁用UITableViewCell上的UILongPressGestureRecognitor,iphone,uitableview,uigesturerecognizer,long-press,Iphone,Uitableview,Uigesturerecognizer,Long Press,在表格视图中,我在每个单元格上都有一个ui长按GestureRecognitor,我这样添加: UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector

在表格视图中,我在每个单元格上都有一个
ui长按GestureRecognitor
,我这样添加:

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] 
                                          initWithTarget:self 
                                          action:@selector(TableCellLongPressed:)];
longPress.minimumPressDuration = 0.5f;
[cell addGestureRecognizer:longPress];
[longPress release];
[self.myTableView setEditing:!self.myTableView.editing animated:YES];
现在我确实有以下问题,我希望用户能够在tableview中重新排列单元格,因此我有一个按钮,可以将tableview设置为编辑模式,如下所示:

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] 
                                          initWithTarget:self 
                                          action:@selector(TableCellLongPressed:)];
longPress.minimumPressDuration = 0.5f;
[cell addGestureRecognizer:longPress];
[longPress release];
[self.myTableView setEditing:!self.myTableView.editing animated:YES];
现在,当用户尝试拖动单元格时,如果拖得不够远,longPress会启动他的操作,这对用户来说非常烦人,因为会推送另一个视图。
当tableView处于编辑模式时,如何暂停或禁用UILongPressGestureRecognitizer。

您应该为此方法实现UIGestureRecognitizer委托:

手势识别器:应接收触摸:

在方法中,检查是否正在编辑该表,如果正在编辑,则返回NO


蒂姆不知道我怎么会忽视这种方法。谢谢,很好用。