2013-03-07 70 views
0

我在滾動視圖iOS中有一個標籤。
並更新標籤文本的計時器。
它工作正常,但如果我滾動滾動視圖,標籤不更新如何更新滾動視圖中的標籤文本ios

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDown) userInfo:nil repeats:YES]; 

- (void) countDown { 
     label.text = [[NSDate date] description]; 
} 

答案在這裏:My custom UI elements are not being updated while UIScrollView is scrolled

+1

向我們顯示代碼。還請準確描述您的期望和看到/未看到的內容。 – rooftop 2013-03-07 17:39:08

+0

http://stackoverflow.com/questions/4109898/my-custom-ui-elements-are-not-being-updated-while-uiscrollview-is-scrolled 這裏是我的問題的答案 – mthuong 2013-03-28 01:42:07

回答

0
[self performSelector:@selector(onTick:) withObject:nil afterDelay:2.0]; 

-(void)onTick:(NSTimer *)timer { 
    label.text = //what you want. 
} 

希望這有助於..

+0

它可以當我滾動滾動視圖時不更新標籤文本 – mthuong 2013-03-27 17:38:53

0

使用此UIScrollViewDelegate方法更新標籤

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 
{ 
    // here update your label 
} 
+0

我希望每隔一秒更新標籤文本 – mthuong 2013-03-27 17:30:52