我一直有這個問題從過去幾個小時,並做了所有的搜索,我可以,但不幸的是,我沒有找到任何解決我的問題.... 情景:我有TimerViewController中的CountDownTimer ,NSTimer和其他方法在AppDelegate中設置,這是假設更新TimerViewController的Label ...按照標籤的setter,我得到的值正確,並顯示在NSLog中,但標籤沒有在屏幕上更新。 。此setter正在從AppDelegate中調用每次第二和標籤是假設給出的T,從appDelegate更新UILabel
- (void)setMainTimerLabel:(UILabel *)mainTimerLabel
{
_mainTimerLabel = mainTimerLabel;
NSLog(@"ValueUpdated %@",_mainTimerLabel);
}
我有雙重檢查的標籤,它迷上了界面心病直接,我試圖從測試字符串更新ViewDidLoad的標籤,標籤顯示我的字符串... 請幫助!
編輯: 的AppDelegate代碼:
AppDelegate.h
@property (nonatomic, strong) TimerViewController *TimerVC;
- (void)fireTimer;
AppDelegate.m
- (void)fireTimer
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDownTimer) userInfo:nil repeats:YES];
}
- (void) countDownTimer
{
.......
TimerVC = [[TimerViewController alloc]init];
self.TimerVC.mainTimerLabel = [NSString stringWithFormat:@"%02d:%02d:%02d",hours,minutes,seconds];
.......
}