
在網(wǎng)上找了好多解決的方法,原因是輸入法設(shè)置為中文時(shí),我想輸入中文“王”,我輸入一個(gè)字母w的時(shí)候,一下回調(diào)會(huì)被調(diào)用- (void)textViewDidChange:(UITextView *)textView
綜合了許多的方法 ,選了一個(gè)最好的解決方法如圖

- (void)textViewDidChange:(UITextView *)textView
{
if (textView.markedTextRange == nil) {
//編輯時(shí)把placeholder效果顏色變?yōu)檎PЧ?/p>
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,代表有候選字符,不做判斷范圍。
結(jié)果如下圖

終于解決啦 ?謝謝網(wǎng)絡(luò)上各位大神的提供的幫助。