3

UITextField shouldChangeCharactersInRange delegate method is not called when a word is selected from autocorrection bar with simplified Chinese keyboard. When I type 'ni hao', this delegate method gets called for each character, but when I selected a word from autocorrect suggestion bar this delegate method is not called. This is only happening in iOS 7 with simplified chinese, it is working fine with japanese keyboard. I want to do my application specific action when selecting the word. Any help is much appreciated.

Mutawe
  • 6,464
  • 3
  • 47
  • 90
bricky
  • 33
  • 4

2 Answers2

2

I meet the same issue today. I fixed it as below:

Don't use delegate, just use Notification:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextFieldTextDidChangeNotification object:nil];

AnkyHe
  • 76
  • 1
  • 6
  • I tried this, but its not worked for me,What you implemented in textChanged event.? please tell me more about your implementation it will be helpful for me. – Sabareesh Jan 17 '14 at 11:22
0

I encountered this issue, too. Thanks to @AnkyHe 's solution. Here is my implemention.

In the ViewController which hold your UITextField:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(textChanged:)
                                                 name:UITextFieldTextDidChangeNotification
                                               object:nil];
}

- (void)textChanged:(NSNotification *)notif
{
    UITextField *editingTextField = (UITextField *)notif.object;
    NsLog(@"changed textL %@", editingTextField.text);
}
billbai
  • 143
  • 1
  • 6