Reputation: 43
I want to know if possible, to change the letter typed by keyboard before to display in a UITexfield (To create a secret code) and then in other UITextfield decodify it.
i. e.
I type " a " and then UITextfield Will display "d" and other UITexfield to read and invert "d" to " a"
Upvotes: 0
Views: 95
Reputation: 3545
Yes, use method – textField:shouldChangeCharactersInRange:replacementString: in UITextFieldDelegate.
f.e.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString* encodedString = [self encode:string];
textField.text = [textField.text stringByReplacingCharactersInRange:range withString:
encodedString];
self.decodedTextField.text = [self.decodedTextField.text stringByReplacingCharactersInRange:range withString:string];
return NO;
}
it is just example, you should implement replacement more careful.
Upvotes: 2