- //设置通知
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector (textFieldChange:)
- name:UITextFieldTextDidChangeNotification object:_commentTextField];
- //实现通知方法
- - (void) textFieldChange:(NSNotification *)notification{
- UITextField *textField=[notification object];
- }
- /*****************************************************************************/
- _textField = [[UITextField alloc]initWithFrame:CGRectMake(5, 10, SCREEN_WIDTH-10, 40)];
- [_textField addTarget:self action:@selector(textFieldDidChangee:) forControlEvents:UIControlEventEditingChanged];
- //点击方法
- - (void)textFieldDidChangee:(UITextField *)textField
- {
- NSLog(@"333%@",textField);
- }
来源: http://www.phpxs.com/code/1006518/