IOS中的UITextView和UITextField都是文本输入控件并都能够调用系统键盘。
UITextField :
只能输入一行,不可以滚动显示浏览全文,可以设置提醒文字(有placeholder属性),有占位,继承自UIView[UIControl]。
UITextView:
能输入多行,可以滚动显示浏览全文,不可以设置提醒文字(没有placeholder属性),无占位,继承自UIScrollView。
占位:UIBarButtonSystemItemFlexibleSpace
1,UITextView
我们可以在- (void)textViewDidChange:(UITextView *)textView[检测到输入变化的时候执行]和
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text[超过一定字数返回NO即可]
2,UITextField
简单的方法只能在 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; 方法中处理。
链接:http://www.jianshu.com/p/889a87595a51
uitextview
链接:http://www.jianshu.com/p/14385b1db4f3