1
如何更改ios5.I中textview文本的特定單詞的文本顏色已經實現了一個應用程序,我在textview中顯示了mangalAshtak shlok。它還具有播放按鈕起着曼加勒ashtak.Now的音頻文件,我想與同步TextView的。②音頻文件都使用上面的代碼在iOS 6中實現了這個使用NSMutableAttributedString如下如何更改ios5中textview的特定單詞的文本顏色
if(seconds>=42 && seconds<43)
{
NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.textView.text];
NSString *word= [shlok2 objectAtIndex:0]; //array shlok 2 contains each word of shlok
NSLog(@"%@",word);
NSRange range=[self.textView.text rangeOfString:word];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:range];
[self.textView setAttributedText:string];
[textView setFont:[UIFont systemFontOfSize:16]];
}
它改變文本的顏色搭配音頻文件。在播放按鈕動作中,我檢查了當前AVAudioPlayer對象&的時間改變了各自的文本。但是在ios 5中它不起作用?
我已經從GitHub下載了DTCoreText框架並試圖運行,但我得到了像'DTUtils.h'文件沒有找到的錯誤。請幫助如何在我的項目中使用該框架 – poojathorat