Jalal Jabarkhiel Jalal Jabarkhiel - 3 months ago 15
iOS Question

ios 8 custom keyboard hold button to delete?

I am currently building a custom keyboard and I am almost done. One problem that I have is with the delete button. When the user taps the delete button, it does what it should do and deletes the previous text entry. However when the user holds the button down, nothing happens. How do I make it so that when the user holds down the delete button, the keyboard continuously deletes like in the standard ios keyboard? This is my current code:

pragma mark Keyboards

- (void)addGesturesToKeyboard{
[self.keyboard.deleteKey addTarget:self action:@selector(pressDeleteKey)forControlEvents:UIControlEventTouchUpInside];


[self.textDocumentProxy deleteBackward];

Thanks for your help.


Set a counter as soon as the screen is touched, such as 2-5 seconds. The situation known as Long press gesture, and here is the link to the simliar questions.

Long press gesture on UICollectionViewCell