2011-02-25 37 views
0

我製作了一個Voca應用程序。 播放語音文件並顯示英文文本後,顯示含義標籤。 因此,我想在播放下一個語音文件之前隱藏標籤文本。在計時器接近標籤,它可以更新標籤字符串

我有problem.df 這些標籤不會隱藏。

靠近定時器的標籤,它可以更新標籤串。

什麼問題? 請幫幫我!


- (void)showLabel{ 

    Word *word = [wordArray objectAtIndex:selectedIndex]; 
    [simpleMeaning setText:word.mean]; 

    NSTimer *timer2 = [[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(hideLabel) userInfo:nil repeats:NO] retain]; 
    [timerArray addObject:timer2]; 
    [timer2 release]; 
    timer2 = nil; 


} 

- (void)hideLabel{ 

    [simpleMeanig setText:@" "]; 
    ++selectedIndex; 
    [self filePlay]; 

} 

回答

-1

我想知道如果調用filePlay被阻塞UI更新(很難說沒有看到filePlay的膽量)。

這只是一個猜測,但不是:

[self filePlay]; 

嘗試:

[self performSelectorOnMainThread:(@selector(filePlay) withObject:nil waitUntilDone:NO]; 

這將推遲調用filePlay直到當前的事件後(如定時器觸發的結果)已被處理(這應該反過來允許UI自我刷新)。

+0

非常感謝你的回答。其實我找到原因。我製作了錯字標籤的名字。非常感謝你。 – chocostream