【iOS开发】UITextField/UITextView实时获取输入内容

//UITextField:
[infoTextField addTarget:self action:@selector(textFieldEditChanged:)  forControlEvents:UIControlEventEditingChanged];
- (void)textFieldEditChanged:(UITextField*)textField
{
        realName = textField.text;

}

//UITextView:

实现其delegate方法

- (void)textViewDidChange:(UITextView *)textView

{
        NSLog(@"text:%@", textView.text);
}

你可能感兴趣的:(【iOS开发】UITextField/UITextView实时获取输入内容)