2
爲什麼不在iPhone上更新UILabel:「lbl」?無法從重複的NSTimer更新UILabel?
... 從方法中:
myTimer =[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(displayDataTimer) userInfo:nil repeats:YES];
...
-(void) displayDataTimer{
NSString *temp = [textField1 text];
[lbl setText:[NSString stringWithFormat:@"%d %d", j, genValue]];
//[self.view setNeedsDisplay:YES];
j++;
}
THX
請注意[timer fire methods](http://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Timers/Articles/usingTimers.html#//apple_ref/doc/uid/20000807-SW1)不應該無參數。它們應該如下所示:' - (void)displayDataTimer:(NSTimer *)tim;'定時器是否在主線程上創建?你確定火法正在運行嗎? – 2012-01-09 20:31:40