美文网首页
textFiled协议方法计算输入的文字长度

textFiled协议方法计算输入的文字长度

作者: 吞风吻雨葬落日未曾彷徨 | 来源:发表于2016-05-18 14:51 被阅读28次
// 通过每次输入的内容,返回YES,则会在textField做显示,否则不显示
- (BOOL)textField:( UITextField *)textField shouldChangeCharactersInRange:( NSRange )range replacementString:( NSString *)string {
         _strLengthPhone = textField.text.length - range.length + string.length;
// _strLengthPhone是计算的文字长度
    return YES;
}

相关文章

网友评论

      本文标题:textFiled协议方法计算输入的文字长度

      本文链接:https://www.haomeiwen.com/subject/iadwrttx.html