From ea5e616f10636a13a6e794e027784c9bd14469d5 Mon Sep 17 00:00:00 2001 From: Evgenii Vedenin Date: Wed, 29 Nov 2017 07:46:30 +0300 Subject: [PATCH] Add textField:shouldChangeCharactersInRange:replacementString: to THContactPickerDelegate --- Classes/THContactPickerView.h | 1 + Classes/THContactPickerView.m | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Classes/THContactPickerView.h b/Classes/THContactPickerView.h index 603942f..8eb9657 100755 --- a/Classes/THContactPickerView.h +++ b/Classes/THContactPickerView.h @@ -21,6 +21,7 @@ - (void)contactPicker:(THContactPickerView *)contactPicker textFieldDidEndEditing:(UITextField *)textField; - (BOOL)contactPicker:(THContactPickerView *)contactPicker textFieldShouldReturn:(UITextField *)textField; - (void)contactPicker:(THContactPickerView *)contactPicker textFieldDidChange:(UITextField *)textField; +- (BOOL)contactPicker:(THContactPickerView *)contactPicker textFieldShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; @end diff --git a/Classes/THContactPickerView.m b/Classes/THContactPickerView.m index 8b50979..6a07ae9 100755 --- a/Classes/THContactPickerView.m +++ b/Classes/THContactPickerView.m @@ -541,6 +541,14 @@ - (void)textFieldDidEndEditing:(UITextField *)textField { } } +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string +{ + if ([self.delegate respondsToSelector:@selector(contactPicker:textFieldShouldChangeCharactersInRange:replacementString:)]){ + return [self.delegate contactPicker:self textFieldShouldChangeCharactersInRange:range replacementString:string]; + } + return YES; +} + #pragma mark - THContactViewDelegate Functions - (void)contactViewWasSelected:(THContactView *)contactView {