how to use kvo to observer textfiled's text change? [duplicate]
问题 This question already has answers here : UITextField text change event (18 answers) Closed 3 years ago . the demo is very simple // add a textField to viewController's view UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 30, 375, 40)]; self.textField = textField; textField.placeholder = @"Please input text"; // add observer for textField's attribute "text" [textField addObserver:self forKeyPath:@"text" options:NSKeyValueObservingOptionNew |