- m_contentTextField = [[[UITextView alloc] init] autorelease];
- m_contentTextField.frame = CGRectMake(0, 0, 320, 90) ;
- m_contentTextField.backgroundColor = [UIColor whiteColor] ;
- m_contentTextField.font = [UIFont systemFontOfSize:14];
- m_contentTextField.delegate = self ;
- [m_contentTextField becomeFirstResponder];
- - (void)textViewDidChange:(UITextView *)textView {
- NSLog(@"textViewDidChange:%@", textView.text);
- }
一定要记得在头文件中导入UITextViewDelegate哦。
附加:
该代理还实现了以下几种监听事件– textViewShouldBeginEditing:
– textViewDidBeginEditing:
– textViewShouldEndEditing:
– textViewDidEndEditing:
