UILongPressGestureRecognizer像iOS中的删除按钮一样工作

时间:2014-07-05 18:38:25

标签: ios uigesturerecognizer

我删除了删除文字的按钮。

我想用UILongPressGestureRecognizer连续删除文本,例如iOS内置键盘删除按钮。

这是我的代码

UILongPressGestureRecognizer *ges = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureAction:)];
    ges.minimumPressDuration = 0.7;
    ges.numberOfTouchesRequired = 1;
    ges.delegate = self;

    [self.deleteButton addGestureRecognizer:ges];

- (void)longPressGestureAction : (UILongPressGestureRecognizer *)lon
{
    [self deleteAction];
}

当我在删除按钮中长按并删除一个字母时,上面的代码只能工作一次。但是它不能连续删除。 但是,当我移动到删除按钮上方时,它会在每个字母上连续删除。

但我不想在删除按钮上方移动。我想连续删除删除按钮而不移动。

我该怎么做?

0 个答案:

没有答案