
核心代码如下
-(void)textViewDidChange:(UITextView *)textView
{
if (textView.text.length>150)
{
textView.text=[textView.text substringFromIndex:textView.text.length-150];
//超出150个字数会有弹框提醒
[CCCommonAPI showCommonAlertTitle:K_CC_LOCAL_STR(@"Alert.prompt") message:K_CC_LOCAL_STR(@"hignseaspool.enter.characters") cancelAction:NO otherActionTitle:K_CC_LOCAL_STR(@"Alert.confirm") otherActionHandler:nil persentCompletion:nil];
}
self.lblTip.text = [NSString stringWithFormat:@"%ld/150",self.textReason.text.length];
}
网友评论