2012-12-17 4 views
1

에 의한 문자열을 사용하여 전경 색상 변경이 코드는 아이폰 OS 6에 잘 작동에서 iOS 5는 : UITextView

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:textView.text]; 

[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:[textView.text rangeOfString:self.searchString options:NSCaseInsensitiveSearch range:searchRange]]; 

[textView setAttributedText:attributedString]; 

그러나 NSForegroundColorAttributeName는에서 iOS 5에서 정의되지 않는다, 그래서에서 iOS 5에서 작동 이전 코드의 동등합니다

답변