清除文本字段中的文本,长按清除按钮,iPhone [英] Clear text in text field long press clear button iphone

查看:55
本文介绍了清除文本字段中的文本,长按清除按钮,iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在构建自定义键盘,我差不多完成了.我遇到的一个问题是删除按钮.当用户点击删除按钮时,它会执行应做的操作并删除上一个文本输入.但是,当用户按下按钮时,什么也不会发生.我如何做到这一点,以便在用户按住Delete键时,键盘像在标准ios键盘中一样连续不断地删除?

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?

推荐答案

您还应该通过以下方式为删除按钮注册操作 UIControlEventTouchDownRepeat .

You should also register for the action UIControlEventTouchDownRepeat for delete button by below way.

[deleteButton addTarget:self action:@selector(deleteCharacter:) forControlEvents:UIControlEventTouchDownRepeat];

这篇关于清除文本字段中的文本,长按清除按钮,iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆