2015-07-15 UITextView text length limitation ios iOS8 以上键盘的自动联想功能使UITextView的长度限制产生一些bug 再谈multistage text input(中文输入法)下UITextView的内容长度限制 textViewDidChange: crashes in iOS 7 1234567891011121314#define textLimitLength 50#pragma mark - UITextViewDelegate- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { if (textView.text.length >= textLimitLength && text.length > range.length) { return NO; } return YES;}- (void)textViewDidChange:(UITextView *)textView { if (textView.markedTextRange == nil && textView.text.length > textLimitLength) { textView.text = [textView.text substringToIndex:textLimitLength]; }} < self signed certificates in iOS reactive cocoa note >