
在网上找了好多解决的方法,原因是输入法设置为中文时,我想输入中文“王”,我输入一个字母w的时候,一下回调会被调用- (void)textViewDidChange:(UITextView *)textView
综合了许多的方法 ,选了一个最好的解决方法如图

- (void)textViewDidChange:(UITextView *)textView
{
if (textView.markedTextRange == nil) {
//编辑时把placeholder效果颜色变为正常效果
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineSpacing = 8;
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:15],NSParagraphStyleAttributeName:paragraphStyle,NSForegroundColorAttributeName:[UIColor blackColor]};
_textView.attributedText = [[NSAttributedString alloc]initWithString:_textView.text attributes:attributes];
}
}
if (textView.markedTextRange == nil)加上这句话判断下是否有候选字符,如果不为nil,代表有候选字符,不做判断范围。
结果如下图

终于解决啦 谢谢网络上各位大神的提供的帮助。