如何修复UITextView的文本长度? [英] how text length of a UITextView can be fixed?

查看:111
本文介绍了如何修复UITextView的文本长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UITextView,用户可以在textView中写入最多160个字符。
如何修复UITextView的最大文本长度?

I have a UITextView, user can write maximum 160 character in the textView. How can i fixed the maximum text length of a UITextView?

推荐答案

替换

 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

with

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text

已回答这里

这篇关于如何修复UITextView的文本长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆