【问题标题】:Highlighting the background color of a text with fading animation after 1 sec1 秒后使用淡入淡出的动画突出显示文本的背景颜色
【发布时间】:2010-12-09 09:04:08
【问题描述】:

我现在正在实现一本电子书,当文本的音频播放时,我必须在其中突出显示每个单词。突出显示的颜色将在 2 秒后消失。我们如何为文本添加背景颜色。我没有使用 UILabel,因为有很多句子的冗长文本。 我们应该怎么做?任何人请帮忙!谢谢!

【问题讨论】:

    标签: iphone objective-c xcode core-animation core-graphics


    【解决方案1】:
                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]; 
    

    第二个问题的答案:

    UIWebView *wizardSpeechWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0,100,320,265)];
    wizardSpeechWebView.backgroundColor = [UIColor clearColor];
    wizardSpeechWebView.opaque = NO; 
    wizardSpeechWebView.delegate = self;
    [self.view addSubview:wizardSpeechWebView];
    

    【讨论】:

    • 非常感谢!我们如何才能让我们清除 UIWebView 的白色背景色?
    猜你喜欢
    • 1970-01-01
    • 2012-05-31
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    • 1970-01-01
    • 2010-11-01
    • 2010-11-11
    • 2020-04-01
    相关资源
    最近更新 更多