iOS限制UITextfield的字数
之前在cocoachina看到一篇文章http://www.cocoachina.com/ios/20160106/14889.html,挺实用的,非常好用,肯定以后可以遇到,登录的时候肯定能遇到 - (void)textFieldTextDidChanged:(UITextField *)sender { NSString * tempString = sender.text; if (sender.markedTextRange == nil && tempString.length > kMaxLength) { sender.text = [tempString substringToIndex:kMaxLength]; [sender.undoManager removeAllActions]; } }
网站题目:iOS限制UITextfield的字数
标题来源:http://myzitong.com/article/ipopop.html