I have an UITextField and I would like that for every tap on a character, the first character is deleted. So that I just have one character in my textField every time. Moreover I would like it to display every tap in the console log.
How can I do this?
You need to implement
shouldChangeCharactersInRangemethod in your text field delegate:You may need to check for range and string values to cover all possible cases (like copy/paste actions). This code just sets the text field’s value to the last typed character.