ios 8 custom keyboard hold button to delete?

前端 未结 4 523
无人共我
无人共我 2021-01-13 12:03

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 shou

4条回答
  •  一生所求
    2021-01-13 12:34

    - (void)addGesturesToKeyboard{
    
     UILongPressGestureRecognizer *ges = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
        ges.minimumPressDuration = 0.1;
        ges.numberOfTouchesRequired = 1;
        ges.delegate = self;
        [self.mykeyboard.deleteKey addGestureRecognizer:ges];
    }
    
    - (void)longPress:(UILongPressGestureRecognizer*)gesture {
    
    
            [self.textDocumentProxy deleteBackward];
    }
    

提交回复
热议问题