In an attempt to Detect backspace in UITextField,
I've tried subclassing UITextField
and overriding -[UIKeyInput deleteBackward]
, but it never gets called. So, I'm suspecting UITextField
swizzles deleteBackward
to another method name.
Using the Objective-C Runtime, how can I determine which method name deleteBackward
has been swizzled to? Then, how can I change the implementation so that UITextField
will call [self.delegate textField:self shouldChangeCharactersInRange:NSMakeRange(0, 0) replacementString:@""]
when the delete key is pressed when it's empty.
Also, will this kind of metaprogramming get my app rejected from the App Store?