Reputation: 2057
I have a situation where I need to have a "backspace" key press event inside a textfield. Is there a direct method to use this event, or do I have to implement the textfield delegate and apply some logics.
Upvotes: 0
Views: 441
Reputation: 6268
You don't have to use a delegate essentially. You can set up a notification like below,
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleTextFieldChanged:)
name:UITextFieldTextDidChangeNotification
object:searchTextField];
and you can handle the change by implementing handleTextFieldChanged.
This may help Detect backspace in UITextField
Upvotes: 1