📜  如何在 ios 中将取消删除的文本添加到文本字段 - Objective-C 代码示例

📅  最后修改于: 2022-03-11 15:04:45.159000             🧑  作者: Mango

代码示例1
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (textField.text.length == 1 && [string isEqualToString:@""]) {//When detect backspace when have one character. 
        textField.text = @"myText";
    }
    return YES;
}