有以下内容:
// watch the fields
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleTextChange:)
name:UITextFieldTextDidChangeNotification
object:textField1];
Run Code Online (Sandbox Code Playgroud)
然后:
-(void) handleTextChange:(NSNotification *)notification {
...
}
Run Code Online (Sandbox Code Playgroud)
有一个断点-handleTextChange:,但不会被解雇.textField在Interface Builder中连接.
适用于iOS5 iPhone/iPad模拟器,适用于iOS5.1 iPad2,但不适用于iOS6 iPad3.