ios 监听UITextField输入

1、添加方法

[_phoneField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];

2、//监听输入框

- (void)textFieldDidChange:(UITextField *)theTextField{

NSLog( @" %@", theTextField.text);

NSLog( @"输入文本长度: %ld", theTextField.text.length);

}

你可能感兴趣的:(ios 监听UITextField输入)