gpt4 book ai didi

ios - 以编程方式关闭 iOS 键盘的退格批量删除功能

转载 作者:可可西里 更新时间:2023-11-01 06:09:45 25 4
gpt4 key购买 nike

有没有办法禁用 iOS 键盘的功能,即当您按住退格键足够长的时间时,它会开始一次删除许多字符?

最佳答案

您可以使用 UITextViewDelegate(或 UITextFieldDelegate 方法)shouldChangeTextInRange 阻止用户一次删除单词。

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (text.length == 0) {
//Backspace
return range.length == 1;
}
return YES;
}

关于ios - 以编程方式关闭 iOS 键盘的退格批量删除功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19802946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com