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的字数
URL分享:http://scyanting.com/article/ipopop.html