How to add undelete texts to textfield in ios

In this article let’s discuss about How to add undelete texts to textfield in ios. Let’s go through the following methods without any delay 🙂

Method 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;
}

Hope the above methods works for you. Happy Learning and get back to us Anytime.

Realted Posts : Loop in objective c