我现在正在实施一个电子书,我必须在播放文本音频时突出显示每个单词。突出显示的颜色将在2秒后消失。我们如何为文本添加背景颜色。我没有使用UILabel,因为有很多句子的冗长文本。 我们应该怎么做?有人请帮忙!谢谢!
答案 0 :(得分:0)
I think u should use UIWebView rather than UITextView, and dynamically u can
highlight the text by adding html tags and style tag around a particular string. But
for that u need to track which string or text audio is playing. Both of these operations
should be performed simultaneously,i.e., Audio Playing and attaching tags aroynd the tags.
Now if u want to fade off the color of the text after two seconds , simply call function
after delay of two seconds, in which u can change the text color back to earlier on.
To call function after delay u should go for
[self performSelector:@selector(changeTooriginalColor) withObject:nil afterDelay:2];
你的第二个问题是aawer:
UIWebView *wizardSpeechWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0,100,320,265)];
wizardSpeechWebView.backgroundColor = [UIColor clearColor];
wizardSpeechWebView.opaque = NO;
wizardSpeechWebView.delegate = self;
[self.view addSubview:wizardSpeechWebView];