UITextFieldTextDidChangeNotification doesn't get called on ios6 ipad3

后端 未结 5 1521
天命终不由人
天命终不由人 2021-02-14 09:29

have the following:

// watch the fields
[[NSNotificationCenter defaultCenter]  addObserver:self
                                          selector:@selec         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-14 09:46

    As a temporary workaround until Apple fixes this, you can use the following code example:

    //view is a UITextField
    NSString *temp = ((UITextField*)view).text;
    ((UITextField*)view).text = @"";
    [((UITextField*)view) insertText:[NSString stringWithFormat:@"%@%@", @"-", temp]];
    

    That code will continue to fire the event.

    This works too:

    [((UITextField*)view) sendActionsForControlEvents:UIControlEventEditingChanged];
    

提交回复
热议问题